[glib/finalize-speedups: 2/4] gobject: Use g_datalist_id_remove_multiple




commit 697e2972741fcde145a6b74f13ac7a667e0aac5f
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun May 22 07:22:16 2022 -0400

    gobject: Use g_datalist_id_remove_multiple
    
    This speeds up object finalization a little.

 gobject/gobject.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index a7a1d3032d..b70d7e5999 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -1181,10 +1181,15 @@ g_object_do_get_property (GObject     *object,
 static void
 g_object_real_dispose (GObject *object)
 {
+  GQuark keys[3];
+
   g_signal_handlers_destroy (object);
-  g_datalist_id_set_data (&object->qdata, quark_closure_array, NULL);
-  g_datalist_id_set_data (&object->qdata, quark_weak_refs, NULL);
-  g_datalist_id_set_data (&object->qdata, quark_weak_locations, NULL);
+
+  keys[0] = quark_closure_array;
+  keys[1] = quark_weak_refs;
+  keys[2] = quark_weak_locations;
+
+  g_datalist_id_remove_multiple (&object->qdata, keys, G_N_ELEMENTS (keys));
 }
 
 #ifdef G_ENABLE_DEBUG


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