[Xfce4-commits] <xfce4-weather-plugin:master> Set freed variables NULL only where appropriate.

Harald Judt noreply at xfce.org
Mon Aug 6 13:20:01 CEST 2012


Updating branch refs/heads/master
         to cc878a73eaccabfc476f523c8ae5b52bca2b5557 (commit)
       from 48002cfa81933249987be0f2b549d67a4193fd55 (commit)

commit cc878a73eaccabfc476f523c8ae5b52bca2b5557
Author: Harald Judt <h.judt at gmx.at>
Date:   Mon Aug 6 10:25:31 2012 +0200

    Set freed variables NULL only where appropriate.
    
    It's not necessary to set freed variables NULL in various places,
    in the xml_*_free functions it doesn't even have an effect because
    it's only a pointer, not a pointer to a pointer. The calling
    function should take care about that (if necessary).

 panel-plugin/weather-parsers.c |    4 ----
 panel-plugin/weather.c         |    4 +++-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/panel-plugin/weather-parsers.c b/panel-plugin/weather-parsers.c
index d5c9df6..f63571d 100644
--- a/panel-plugin/weather-parsers.c
+++ b/panel-plugin/weather-parsers.c
@@ -454,7 +454,6 @@ xml_location_free(xml_location *loc)
     g_free(loc->precipitation_unit);
     g_free(loc->symbol);
     g_slice_free(xml_location, loc);
-    loc = NULL;
 }
 
 
@@ -466,7 +465,6 @@ xml_time_free(xml_time *timeslice)
         return;
     xml_location_free(timeslice->location);
     g_slice_free(xml_time, timeslice);
-    timeslice = NULL;
 }
 
 
@@ -483,7 +481,6 @@ xml_weather_free(xml_weather *data)
     }
     xml_time_free(data->current_conditions);
     g_slice_free(xml_weather, data);
-    data = NULL;
 }
 
 
@@ -495,7 +492,6 @@ xml_astro_free(xml_astro *astro)
         return;
     g_free(astro->moon_phase);
     g_slice_free(xml_astro, astro);
-    astro = NULL;
 }
 
 
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index fbf65ad..a998558 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -337,8 +337,10 @@ update_current_conditions(xfceweather_data *data)
         return;
     }
 
-    if (data->weatherdata->current_conditions)
+    if (data->weatherdata->current_conditions) {
         xml_time_free(data->weatherdata->current_conditions);
+        data->weatherdata->current_conditions = NULL;
+    }
 
     data->weatherdata->current_conditions =
         make_current_conditions(data->weatherdata);


More information about the Xfce4-commits mailing list