[glib/gobject-speedup8] Avoid g_param_spec_get_redirect_target




commit 8f41ef82a2ddddf695cfdb433dab42f08c80a604
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 | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index 3348426a84..0b38aa4068 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -1319,14 +1319,11 @@ static inline void
 g_object_notify_by_spec_internal (GObject    *object,
                                   GParamSpec *pspec)
 {
-  GParamSpec *redirected;
-
   if (G_UNLIKELY (~pspec->flags & G_PARAM_READABLE))
     return;
 
-  redirected = g_param_spec_get_redirect_target (pspec);
-  if (redirected != NULL)
-    pspec = redirected;
+  if (((GTypeInstance *) pspec)->g_class->g_type == G_TYPE_PARAM_OVERRIDE)
+    pspec = ((GParamSpecOverride *)pspec)->overridden;
 
   if (pspec != NULL)
     {
@@ -1548,7 +1545,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)
     {
@@ -1557,9 +1553,8 @@ object_get_property (GObject     *object,
       return;
     }
 
-  redirect = g_param_spec_get_redirect_target (pspec);
-  if (redirect)
-    pspec = redirect;
+  if (((GTypeInstance *) pspec)->g_class->g_type == G_TYPE_PARAM_OVERRIDE)
+    pspec = ((GParamSpecOverride *)pspec)->overridden;
 
   consider_issuing_property_deprecation_warning (pspec);
 
@@ -1575,7 +1570,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))
     {
@@ -1584,9 +1578,8 @@ object_set_property (GObject             *object,
       return;
     }
 
-  redirect = g_param_spec_get_redirect_target (pspec);
-  if (redirect)
-    pspec = redirect;
+  if (((GTypeInstance *)pspec)->g_class->g_type == G_TYPE_PARAM_OVERRIDE)
+    pspec = ((GParamSpecOverride *)pspec)->overridden;
 
   pclass = G_PARAM_SPEC_GET_CLASS (pspec);
   if (g_value_type_compatible (G_VALUE_TYPE (value), pspec->value_type) &&


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