[glib/gobject-speedups: 18/26] Don't copy values when collecting in g_object_new




commit d7d62f7d21f4a9735c16c3bf0b2c678891546de1
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat May 14 23:27:54 2022 -0400

    Don't copy values when collecting in g_object_new
    
    We can safely use the values without copying here.

 gobject/gobject.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index e41db2da04..b49114be55 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -2370,7 +2370,7 @@ g_object_new_valist (GType        object_type,
           params[n_params].value = &values[n_params];
           memset (&values[n_params], 0, sizeof (GValue));
 
-          G_VALUE_COLLECT_INIT (&values[n_params], pspec->value_type, var_args, 0, &error);
+          G_VALUE_COLLECT_INIT (&values[n_params], pspec->value_type, var_args, G_VALUE_NOCOPY_CONTENTS, 
&error);
 
           if (error)
             {


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