[Xfce4-commits] <xfce4-weather-plugin:master> Cleanup xml_time_copy.

Harald Judt noreply at xfce.org
Sun Jan 12 01:08:01 CET 2014


Updating branch refs/heads/master
         to fe6baf20e0d6e873efc013b9da13a0abb817abc5 (commit)
       from caa9d6b0d85a9a04980f20eb72b28f76de41005e (commit)

commit fe6baf20e0d6e873efc013b9da13a0abb817abc5
Author: Harald Judt <h.judt at gmx.at>
Date:   Sat Apr 6 18:08:56 2013 +0200

    Cleanup xml_time_copy.
    
    Add a few asserts and compiler optimization hints.

 panel-plugin/weather-parsers.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/panel-plugin/weather-parsers.c b/panel-plugin/weather-parsers.c
index c380130..369adf8 100644
--- a/panel-plugin/weather-parsers.c
+++ b/panel-plugin/weather-parsers.c
@@ -623,16 +623,20 @@ xml_time_copy(const xml_time *src)
     xml_location *loc;
     gint i;
 
-    if (src == NULL)
+    if (G_UNLIKELY(src == NULL))
         return NULL;
 
     dst = g_slice_new0(xml_time);
-    if (dst == NULL)
+    g_assert(dst != NULL);
+    if (G_UNLIKELY(dst == NULL))
         return NULL;
 
     loc = g_slice_new0(xml_location);
-    if (loc == NULL)
-        return dst;
+    g_assert(loc != NULL);
+    if (loc == NULL) {
+        g_slice_free(xml_time, dst);
+        return NULL;
+    }
 
     dst->start = src->start;
     dst->end = src->end;


More information about the Xfce4-commits mailing list