[glib/gobject-speedups: 21/22] Avoid g_param_spec_get_redirect_target




commit b5075686a0390d86d7951b9fee2fefd56f501347
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu May 19 21:00:37 2022 -0400

    Avoid g_param_spec_get_redirect_target
    
    Inline the getting of the redirect target.
    This is a rare thing, and the calls were
    showing up in profiles.

 gobject/gobject.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index 0b8d983bf8..dbb19ae80b 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -1580,7 +1580,6 @@ object_get_property (GObject     *object,
 {
   GObjectClass *class = g_type_class_peek (pspec->owner_type);
   guint param_id = PARAM_SPEC_PARAM_ID (pspec);
-  GParamSpec *redirect;
 
   if (class == NULL)
     {
@@ -1589,9 +1588,8 @@ object_get_property (GObject     *object,
       return;
     }
 
-  redirect = g_param_spec_get_redirect_target (pspec);
-  if (redirect)
-    pspec = redirect;
+  if (G_IS_PARAM_SPEC_OVERRIDE (pspec))
+    pspec = ((GParamSpecOverride *)pspec)->overridden;
 
   consider_issuing_property_deprecation_warning (pspec);
 
@@ -1607,7 +1605,6 @@ object_set_property (GObject             *object,
   GObjectClass *class = g_type_class_peek (pspec->owner_type);
   GParamSpecClass *pclass;
   guint param_id = PARAM_SPEC_PARAM_ID (pspec);
-  GParamSpec *redirect;
 
   if (G_UNLIKELY (class == NULL))
     {
@@ -1616,13 +1613,13 @@ object_set_property (GObject             *object,
       return;
     }
 
-  redirect = g_param_spec_get_redirect_target (pspec);
-  if (redirect)
-    pspec = redirect;
+  if (G_IS_PARAM_SPEC_OVERRIDE (pspec))
+    pspec = ((GParamSpecOverride *)pspec)->overridden;
 
   consider_issuing_property_deprecation_warning (pspec);
 
   pclass = G_PARAM_SPEC_GET_CLASS (pspec);
+
   if ((G_VALUE_TYPE (value) == pspec->value_type ||
        g_value_type_compatible (G_VALUE_TYPE (value), pspec->value_type)) &&
       (pclass->value_validate == NULL ||


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