[glib: 4/17] gdbusproxy: Tidy up some memory management code



commit d9dab2b31904fb6eeae72014d0946874baaa65a8
Author: Philip Withnall <withnall endlessm com>
Date:   Thu Feb 20 11:23:50 2020 +0000

    gdbusproxy: Tidy up some memory management code
    
    Use `g_clear_object()` to tidy things up. This introduces no functional
    changes.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 gio/gdbusproxy.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/gio/gdbusproxy.c b/gio/gdbusproxy.c
index f3b02ccce..22ccc830f 100644
--- a/gio/gdbusproxy.c
+++ b/gio/gdbusproxy.c
@@ -889,8 +889,7 @@ on_signal_received (GDBusConnection *connection,
                  parameters);
 
  out:
-  if (proxy != NULL)
-    g_object_unref (proxy);
+  g_clear_object (&proxy);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -1101,11 +1100,9 @@ on_properties_changed (GDBusConnection *connection,
     }
 
  out:
-  if (changed_properties != NULL)
-    g_variant_unref (changed_properties);
+  g_clear_pointer (&changed_properties, g_variant_unref);
   g_free (invalidated_properties);
-  if (proxy != NULL)
-    g_object_unref (proxy);
+  g_clear_object (&proxy);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -1357,8 +1354,7 @@ on_name_owner_changed (GDBusConnection *connection,
     }
 
  out:
-  if (proxy != NULL)
-    g_object_unref (proxy);
+  g_clear_object (&proxy);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */


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