[glib/prop-set-speedups: 1/2] Small optimization for g_object_set




commit 23e37e05d2134270243852e519e9c715e37aa496
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Sep 20 08:18:32 2021 -0400

    Small optimization for g_object_set
    
    We've already followed the redirection, no need
    to check for that again - just avoid notifying
    non-readable properties.

 gobject/gobject.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index 9776d7c95..3767058c4 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -1570,15 +1570,9 @@ object_set_property (GObject             *object,
     {
       class->set_property (object, param_id, &tmp_value, pspec);
 
-      if (~pspec->flags & G_PARAM_EXPLICIT_NOTIFY)
-        {
-          GParamSpec *notify_pspec;
-
-          notify_pspec = get_notify_pspec (pspec);
-
-          if (notify_pspec != NULL)
-            g_object_notify_queue_add (object, nqueue, notify_pspec);
-        }
+      if (~pspec->flags & G_PARAM_EXPLICIT_NOTIFY &&
+          pspec->flags & G_PARAM_READABLE)
+        g_object_notify_queue_add (object, nqueue, pspec);
     }
   g_value_unset (&tmp_value);
 }


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