[glade/gbinding] Take advantage of the fact that g_free (NULL) safely does nothing



commit 6cec649abf5115701b3fe98ed8e50c002e585911
Author: Denis Washington <denisw src gnome org>
Date:   Fri Jun 10 14:33:12 2011 +0200

    Take advantage of the fact that g_free (NULL) safely does nothing
    
    I didn't know this before to be honest. Again, thanks Juan!

 gladeui/glade-binding.c |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)
---
diff --git a/gladeui/glade-binding.c b/gladeui/glade-binding.c
index 1c2b691..2f4fb16 100644
--- a/gladeui/glade-binding.c
+++ b/gladeui/glade-binding.c
@@ -88,11 +88,8 @@ glade_binding_finalize (GObject *object)
 {
   GladeBindingPrivate *priv = GLADE_BINDING_GET_PRIVATE (GLADE_BINDING (object));
 
-  if (priv->source_object_name)
-    g_free (priv->source_object_name);
-
-  if (priv->source_property_name)
-    g_free (priv->source_property_name);
+  g_free (priv->source_object_name);
+  g_free (priv->source_property_name);
 }
 
 static void
@@ -288,12 +285,9 @@ glade_binding_read (GladeXmlNode *node,
   
   if (!to || !from || !source)
     {
-      if (to)
-        g_free (to);
-      if (from)
-        g_free (from);
-      if (source)
-        g_free (source);
+      g_free (to);
+      g_free (from);
+      g_free (source);
       return NULL;
     }
 



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