[glib: 3/11] Preallocate a GPtrArray to avoid some reallocations later on
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 3/11] Preallocate a GPtrArray to avoid some reallocations later on
- Date: Mon, 25 Feb 2019 13:04:39 +0000 (UTC)
commit 084e1d868081481cd5dcad5e721714e9037ecb52
Author: Philip Withnall <withnall endlessm com>
Date: Thu Aug 16 15:44:09 2018 +0100
Preallocate a GPtrArray to avoid some reallocations later on
Suggested by Georges Basile Stavracas Neto.
Signed-off-by: Philip Withnall <withnall endlessm com>
gvdb-reader.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gvdb-reader.c b/gvdb-reader.c
index ae349a62c..95093885f 100644
--- a/gvdb-reader.c
+++ b/gvdb-reader.c
@@ -462,7 +462,7 @@ gvdb_table_get_names (GvdbTable *table,
{
GPtrArray *fixed_names;
- fixed_names = g_ptr_array_new ();
+ fixed_names = g_ptr_array_sized_new (n_names);
for (i = 0; i < n_names; i++)
if (names[i] != NULL)
g_ptr_array_add (fixed_names, names[i]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]