[glib] Simplify g_param_spec_get_redirect_target a bit more



commit 44af2b1c17b5920052a6bb363c62d8452a570a42
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Sep 7 03:02:11 2015 -0400

    Simplify g_param_spec_get_redirect_target a bit more
    
    It is enough to look for exact matches here, so no need to
    dive into g_type_instance_is_a and take locks, etc.

 gobject/gparam.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/gobject/gparam.c b/gobject/gparam.c
index bf2028e..ec86766 100644
--- a/gobject/gparam.c
+++ b/gobject/gparam.c
@@ -579,7 +579,9 @@ g_param_spec_steal_qdata (GParamSpec *pspec,
 GParamSpec*
 g_param_spec_get_redirect_target (GParamSpec *pspec)
 {
-  if (G_IS_PARAM_SPEC_OVERRIDE (pspec))
+  GTypeInstance *inst = (GTypeInstance *)pspec;
+
+  if (inst && inst->g_class && inst->g_class->g_type == G_TYPE_PARAM_OVERRIDE)
     return ((GParamSpecOverride*)pspec)->overridden;
   else
     return NULL;


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