summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2018-08-16 15:44:09 +0100
committerPhilip Withnall <withnall@endlessm.com>2018-08-16 15:44:09 +0100
commit084e1d868081481cd5dcad5e721714e9037ecb52 (patch)
tree7dc150f3af42667e7e374a292833d9f77a32f6d0
parenta44329c2442ff45d31fe7a0ca45005f145df3187 (diff)
downloadgvdb-084e1d868081481cd5dcad5e721714e9037ecb52.tar.gz
Preallocate a GPtrArray to avoid some reallocations later on
Suggested by Georges Basile Stavracas Neto. Signed-off-by: Philip Withnall <withnall@endlessm.com>
-rw-r--r--gvdb-reader.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gvdb-reader.c b/gvdb-reader.c
index ae349a6..9509388 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]);