[glib/gobject-speedups] Apply 1 suggestion(s) to 1 file(s)



commit cc02e7de06432c1cfcf6a23395330e0fde2bdfe5
Author: Emmanuele Bassi <ebassi gmail com>
Date:   Sun May 15 13:48:29 2022 +0000

    Apply 1 suggestion(s) to 1 file(s)

 gobject/gobject.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index 8ec8881433..1c6019c2f5 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -1916,8 +1916,18 @@ g_object_new_with_custom_constructor (GObjectClass          *class,
    */
 
   /* Create the array of GObjectConstructParams for constructor() */
-  cparams = g_newa0 (GObjectConstructParam, class->n_construct_properties);
-  cvalues = g_newa0 (GValue, class->n_construct_properties);
+  gboolean free_cparams = FALSE;
+  if (class->n_construct_properties < 1024)
+    {
+      cparams = g_newa0 (GObjectConstructParam, class->n_construct_properties);
+      cvalues = g_newa0 (GValue, class->n_construct_properties);
+    }
+  else
+    {
+      cparams = g_new0 (GObjectConstructParam, class->n_construct_properties);
+      cvalues = g_new0 (GValue, class->n_construct_properties);
+      free_cparams = TRUE;
+    }
   cvals_used = 0;
   i = 0;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]