Merge branch 'param-spec-cleanup' into 'main'

gparamspecs: Remove redundant NULL checks

See merge request GNOME/glib!2688
This commit is contained in:
Philip Withnall 2022-05-25 16:04:29 +00:00
commit 44ba3a5f0e

View File

@ -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;
@ -2683,16 +2639,13 @@ g_param_spec_value_array (const gchar *name,
{
GParamSpecValueArray *aspec;
if (element_spec)
g_return_val_if_fail (G_IS_PARAM_SPEC (element_spec), NULL);
g_return_val_if_fail (element_spec == NULL || G_IS_PARAM_SPEC (element_spec), NULL);
aspec = g_param_spec_internal (G_TYPE_PARAM_VALUE_ARRAY,
name,
nick,
blurb,
flags);
if (aspec == NULL)
return NULL;
if (element_spec)
{
@ -2734,8 +2687,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 +2729,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 +2776,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)