From 084e1d868081481cd5dcad5e721714e9037ecb52 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 16 Aug 2018 15:44:09 +0100 Subject: Preallocate a GPtrArray to avoid some reallocations later on Suggested by Georges Basile Stavracas Neto. Signed-off-by: Philip Withnall --- gvdb-reader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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]); -- cgit v1.2.1