[glib: 2/3] gparamspecs: Tidy up a precondition




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

    gparamspecs: Tidy up a precondition
    
    Move the `if` into the precondition assertion, eliminating one line of
    code and making the function preconditions clearer to static analysers.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 gobject/gparamspecs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
---
diff --git a/gobject/gparamspecs.c b/gobject/gparamspecs.c
index 9f281a8288..5a54c667d7 100644
--- a/gobject/gparamspecs.c
+++ b/gobject/gparamspecs.c
@@ -2639,8 +2639,7 @@ 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,


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