[gjs/march-maintenance: 4/6] object: Readability improvement in is_gobject_property_name()



commit 783652c2201732f283942a63a00f197a97d88891
Author: Philip Chimento <philip chimento gmail com>
Date:   Wed Mar 11 22:51:55 2020 -0700

    object: Readability improvement in is_gobject_property_name()
    
    It seems there's no reason not to return early here.

 gi/object.cpp | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index 0371e2fb..cc618621 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -752,21 +752,15 @@ is_gobject_property_name(GIObjectInfo *info,
     for (ix = 0; ix < n_props; ix++) {
         prop_info = g_object_info_get_property(info, ix);
         if (strcmp(canonical_name, prop_info.name()) == 0)
-            break;
-        prop_info.reset();
+            return true;
     }
 
-    if (!prop_info) {
-        for (ix = 0; ix < n_ifaces; ix++) {
-            GjsAutoInterfaceInfo iface_info =
-                g_object_info_get_interface(info, ix);
-            if (is_ginterface_property_name(iface_info, canonical_name))
-                return true;
-        }
-        return false;
+    for (ix = 0; ix < n_ifaces; ix++) {
+        GjsAutoInterfaceInfo iface_info = g_object_info_get_interface(info, ix);
+        if (is_ginterface_property_name(iface_info, canonical_name))
+            return true;
     }
-
-    return true;
+    return false;
 }
 
 // Override of GIWrapperBase::id_is_never_lazy()


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