[glib: 1/3] gparamspecs: Remove redundant NULL checks




commit 96f4c2b095b9a7043c8910f437943555928ea5b3
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed May 25 14:41:03 2022 +0100

    gparamspecs: Remove redundant NULL checks
    
    `g_param_spec_internal()` can never return `NULL`.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 gobject/gparamspecs.c | 54 +--------------------------------------------------
 1 file changed, 1 insertion(+), 53 deletions(-)
---
diff --git a/gobject/gparamspecs.c b/gobject/gparamspecs.c
index f0985984ee..9f281a8288 100644
--- a/gobject/gparamspecs.c
+++ b/gobject/gparamspecs.c
@@ -1879,8 +1879,6 @@ g_param_spec_char (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
-  if (cspec == NULL)
-    return NULL;
   
   cspec->minimum = minimum;
   cspec->maximum = maximum;
@@ -1921,8 +1919,6 @@ g_param_spec_uchar (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
-  if (uspec == NULL)
-    return NULL;
   
   uspec->minimum = minimum;
   uspec->maximum = maximum;
@@ -1965,8 +1961,6 @@ g_param_spec_boolean (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
-  if (bspec == NULL)
-    return NULL;
   
   bspec->default_value = default_value;
   
@@ -2007,8 +2001,6 @@ g_param_spec_int (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
-  if (ispec == NULL)
-    return NULL;
   
   ispec->minimum = minimum;
   ispec->maximum = maximum;
@@ -2051,8 +2043,6 @@ g_param_spec_uint (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
-  if (uspec == NULL)
-    return NULL;
   
   uspec->minimum = minimum;
   uspec->maximum = maximum;
@@ -2095,8 +2085,6 @@ g_param_spec_long (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
-  if (lspec == NULL)
-    return NULL;
   
   lspec->minimum = minimum;
   lspec->maximum = maximum;
@@ -2140,8 +2128,6 @@ g_param_spec_ulong (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
-  if (uspec == NULL)
-    return NULL;
   
   uspec->minimum = minimum;
   uspec->maximum = maximum;
@@ -2184,8 +2170,6 @@ g_param_spec_int64 (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
-  if (lspec == NULL)
-    return NULL;
   
   lspec->minimum = minimum;
   lspec->maximum = maximum;
@@ -2229,8 +2213,6 @@ g_param_spec_uint64 (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
-  if (uspec == NULL)
-    return NULL;
   
   uspec->minimum = minimum;
   uspec->maximum = maximum;
@@ -2269,8 +2251,6 @@ g_param_spec_unichar (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
-  if (uspec == NULL)
-    return NULL;
   
   uspec->default_value = default_value;
   
@@ -2315,12 +2295,7 @@ g_param_spec_enum (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
-  if (espec == NULL)
-    {
-      g_type_class_unref (enum_class);
-      return NULL;
-    }
-  
+
   espec->enum_class = enum_class;
   espec->default_value = default_value;
   G_PARAM_SPEC (espec)->value_type = enum_type;
@@ -2366,11 +2341,6 @@ g_param_spec_flags (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
-  if (fspec == NULL)
-    {
-      g_type_class_unref (flags_class);
-      return NULL;
-    }
   
   fspec->flags_class = flags_class;
   fspec->default_value = default_value;
@@ -2413,8 +2383,6 @@ g_param_spec_float (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
-  if (fspec == NULL)
-    return NULL;
   
   fspec->minimum = minimum;
   fspec->maximum = maximum;
@@ -2458,8 +2426,6 @@ g_param_spec_double (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
-  if (dspec == NULL)
-    return NULL;
   
   dspec->minimum = minimum;
   dspec->maximum = maximum;
@@ -2494,8 +2460,6 @@ g_param_spec_string (const gchar *name,
                                                   nick,
                                                   blurb,
                                                   flags);
-  if (sspec == NULL)
-    return NULL;
 
   g_free (sspec->default_value);
   sspec->default_value = g_strdup (default_value);
@@ -2534,8 +2498,6 @@ g_param_spec_param (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
-  if (pspec == NULL)
-    return NULL;
 
   G_PARAM_SPEC (pspec)->value_type = param_type;
   
@@ -2574,8 +2536,6 @@ g_param_spec_boxed (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
-  if (bspec == NULL)
-    return NULL;
 
   G_PARAM_SPEC (bspec)->value_type = boxed_type;
   
@@ -2610,8 +2570,6 @@ g_param_spec_pointer (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
-  if (pspec == NULL)
-    return NULL;
 
   return G_PARAM_SPEC (pspec);
 }
@@ -2648,8 +2606,6 @@ g_param_spec_gtype (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
-  if (tspec == NULL)
-    return NULL;
 
   tspec->is_a_type = is_a_type;
 
@@ -2691,8 +2647,6 @@ g_param_spec_value_array (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
-  if (aspec == NULL)
-    return NULL;
 
   if (element_spec)
     {
@@ -2734,8 +2688,6 @@ g_param_spec_object (const gchar *name,
                                 nick,
                                 blurb,
                                 flags);
-  if (ospec == NULL)
-    return NULL;
 
   G_PARAM_SPEC (ospec)->value_type = object_type;
   
@@ -2778,8 +2730,6 @@ g_param_spec_override (const gchar *name,
   pspec = g_param_spec_internal (G_TYPE_PARAM_OVERRIDE,
                                 name, NULL, NULL,
                                 overridden->flags);
-  if (pspec == NULL)
-    return NULL;
   
   pspec->value_type = G_PARAM_SPEC_VALUE_TYPE (overridden);
   G_PARAM_SPEC_OVERRIDE (pspec)->overridden = g_param_spec_ref (overridden);
@@ -2827,8 +2777,6 @@ g_param_spec_variant (const gchar        *name,
                                  nick,
                                  blurb,
                                  flags);
-  if (vspec == NULL)
-    return NULL;
 
   vspec->type = g_variant_type_copy (type);
   if (default_value)


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