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




commit 15cba2724e6114976b5891b61d45d3da1fc0740d
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 c4ab23cd2f..3b9b0902e3 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -2369,7 +2369,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]