[Xfce4-commits] <xfce4-weather-plugin:master> Replace variable names "data" with "wd" for weather data.

Harald Judt noreply at xfce.org
Sun Dec 9 23:44:07 CET 2012


Updating branch refs/heads/master
         to ffecf234ed36e75113e7c0073d07ddfb74ece837 (commit)
       from b9fcca223ae6922deb7919060d471565e0d69062 (commit)

commit ffecf234ed36e75113e7c0073d07ddfb74ece837
Author: Harald Judt <h.judt at gmx.at>
Date:   Sun Dec 9 19:24:19 2012 +0100

    Replace variable names "data" with "wd" for weather data.
    
    Use consistent naming; "data" is usually used for plugin data,
    so make weather data distinct for clarity reasons.

 panel-plugin/weather-data.c    |   38 +++++++++++++++++++-------------------
 panel-plugin/weather-data.h    |    6 +++---
 panel-plugin/weather-debug.h   |    2 +-
 panel-plugin/weather-parsers.c |   12 ++++++------
 panel-plugin/weather-parsers.h |    4 ++--
 panel-plugin/weather.c         |    6 +++---
 6 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/panel-plugin/weather-data.c b/panel-plugin/weather-data.c
index 217c19f..4cc84b9 100644
--- a/panel-plugin/weather-data.c
+++ b/panel-plugin/weather-data.c
@@ -434,7 +434,7 @@ interpolate_gchar_value(gchar *value_start,
 
 /* Create a new combined timeslice, with optionally interpolated data */
 static xml_time *
-make_combined_timeslice(xml_weather *data,
+make_combined_timeslice(xml_weather *wd,
                         const xml_time *interval,
                         const time_t *between_t)
 {
@@ -444,10 +444,10 @@ make_combined_timeslice(xml_weather *data,
     guint i;
 
     /* find point data at start of interval (may not be available) */
-    start = get_timeslice(data, interval->start, interval->start);
+    start = get_timeslice(wd, interval->start, interval->start);
 
     /* find point interval at end of interval */
-    end = get_timeslice(data, interval->end, interval->end);
+    end = get_timeslice(wd, interval->end, interval->end);
 
     if (start == NULL && end == NULL)
         return NULL;
@@ -518,11 +518,11 @@ make_combined_timeslice(xml_weather *data,
 
 /* Return current weather conditions, or NULL if not available. */
 xml_time *
-get_current_conditions(const xml_weather *data)
+get_current_conditions(const xml_weather *wd)
 {
-    if (data == NULL)
+    if (wd == NULL)
         return NULL;
-    return data->current_conditions;
+    return wd->current_conditions;
 }
 
 
@@ -579,7 +579,7 @@ time_calc_day(const struct tm time_tm,
  * next_hours_limit hours into the future.
  */
 static xml_time *
-find_timeslice(xml_weather *data,
+find_timeslice(xml_weather *wd,
                struct tm start_tm,
                struct tm end_tm,
                const gint prev_hours_limit,
@@ -599,7 +599,7 @@ find_timeslice(xml_weather *data,
             start_t = time_calc_hour(start_tm, 0 - hours);
             end_t = time_calc_hour(end_tm, 0 - hours);
 
-            if ((timeslice = get_timeslice(data, start_t, end_t)))
+            if ((timeslice = get_timeslice(wd, start_t, end_t)))
                 return timeslice;
         }
 
@@ -608,7 +608,7 @@ find_timeslice(xml_weather *data,
             start_t = time_calc_hour(start_tm, hours);
             end_t = time_calc_hour(end_tm, hours);
 
-            if ((timeslice = get_timeslice(data, start_t, end_t)))
+            if ((timeslice = get_timeslice(wd, start_t, end_t)))
                 return timeslice;
         }
         hours++;
@@ -622,7 +622,7 @@ find_timeslice(xml_weather *data,
  * and end times
  */
 static xml_time *
-find_shortest_timeslice(xml_weather *data,
+find_shortest_timeslice(xml_weather *wd,
                         struct tm start_tm,
                         struct tm end_tm,
                         const gint prev_hours_limit,
@@ -647,7 +647,7 @@ find_shortest_timeslice(xml_weather *data,
     interval = (gint) (difftime(end_t, start_t) / 3600);
 
     while (interval <= interval_limit) {
-        interval_data = find_timeslice(data, start_tm, end_tm,
+        interval_data = find_timeslice(wd, start_tm, end_tm,
                                        prev_hours_limit, next_hours_limit);
         if (interval_data != NULL)
             return interval_data;
@@ -663,7 +663,7 @@ find_shortest_timeslice(xml_weather *data,
 
 
 xml_time *
-make_current_conditions(xml_weather *data,
+make_current_conditions(xml_weather *wd,
                         time_t now_t)
 {
     xml_time *interval_data;
@@ -681,22 +681,22 @@ make_current_conditions(xml_weather *data,
 
     /* We want to keep the hour deviation as small as possible,
        so let's try an interval with ±1 hour deviation first */
-    interval_data = find_shortest_timeslice(data, start_tm, end_tm, -1, 1, 6);
+    interval_data = find_shortest_timeslice(wd, start_tm, end_tm, -1, 1, 6);
     if (interval_data == NULL) {
         /* in case we were unsuccessful we might need to enlarge the
            search radius */
-        interval_data = find_shortest_timeslice(data, start_tm, end_tm,
+        interval_data = find_shortest_timeslice(wd, start_tm, end_tm,
                                                 -3, 3, 6);
         if (interval_data == NULL)
             /* and maybe it's necessary to try even harder... */
-            interval_data = find_shortest_timeslice(data, start_tm, end_tm,
+            interval_data = find_shortest_timeslice(wd, start_tm, end_tm,
                                                     -3, 6, 6);
     }
     if (interval_data == NULL)
         return NULL;
 
     /* create combined timeslice with interpolated point and interval data */
-    return make_combined_timeslice(data, interval_data, &now_t);
+    return make_combined_timeslice(wd, interval_data, &now_t);
 }
 
 
@@ -704,7 +704,7 @@ make_current_conditions(xml_weather *data,
  * Get forecast data for a given daytime for the day (today + day).
  */
 xml_time *
-make_forecast_data(xml_weather *data,
+make_forecast_data(xml_weather *wd,
                    const int day,
                    const daytime dt)
 {
@@ -728,7 +728,7 @@ make_forecast_data(xml_weather *data,
     /* next find biggest possible (limited by daytime) interval data
        using a maximum deviation of ±3 hours */
     while ((interval = (gint) (difftime(end_t, start_t) / 3600)) > 0) {
-        interval_data = find_timeslice(data, start_tm, end_tm, -3, 3);
+        interval_data = find_timeslice(wd, start_tm, end_tm, -3, 3);
         if (interval_data != NULL)
             break;
         end_t = time_calc_hour(end_tm, -1);
@@ -739,5 +739,5 @@ make_forecast_data(xml_weather *data,
 
     /* create combined timeslice with non-interpolated point
        and interval data */
-    return make_combined_timeslice(data, interval_data, NULL);
+    return make_combined_timeslice(wd, interval_data, NULL);
 }
diff --git a/panel-plugin/weather-data.h b/panel-plugin/weather-data.h
index 3f96793..d135235 100644
--- a/panel-plugin/weather-data.h
+++ b/panel-plugin/weather-data.h
@@ -113,12 +113,12 @@ time_t time_calc_hour(struct tm time_tm,
 time_t time_calc_day(struct tm time_tm,
                      gint days);
 
-xml_time *get_current_conditions(const xml_weather *data);
+xml_time *get_current_conditions(const xml_weather *wd);
 
-xml_time *make_current_conditions(xml_weather *data,
+xml_time *make_current_conditions(xml_weather *wd,
                                   time_t now_t);
 
-xml_time *make_forecast_data(xml_weather *data,
+xml_time *make_forecast_data(xml_weather *wd,
                              int day,
                              daytime dt);
 
diff --git a/panel-plugin/weather-debug.h b/panel-plugin/weather-debug.h
index 2e49ea4..43465c0 100644
--- a/panel-plugin/weather-debug.h
+++ b/panel-plugin/weather-debug.h
@@ -72,7 +72,7 @@ gchar *weather_dump_astrodata(const xml_astro *astrodata);
 
 gchar *weather_dump_units_config(const units_config *units);
 
-gchar *weather_dump_weatherdata(const xml_weather *weatherdata);
+gchar *weather_dump_weatherdata(const xml_weather *wd);
 
 gchar *weather_dump_plugindata(const xfceweather_data *data);
 
diff --git a/panel-plugin/weather-parsers.c b/panel-plugin/weather-parsers.c
index 04627f9..2b728d8 100644
--- a/panel-plugin/weather-parsers.c
+++ b/panel-plugin/weather-parsers.c
@@ -69,15 +69,15 @@ my_timegm(struct tm *tm)
 
 
 xml_time *
-get_timeslice(xml_weather *data,
+get_timeslice(xml_weather *wd,
               const time_t start_t,
               const time_t end_t)
 {
     xml_time *timeslice;
     guint i;
 
-    for (i = 0; i < data->timeslices->len; i++) {
-        timeslice = g_array_index(data->timeslices, xml_time*, i);
+    for (i = 0; i < wd->timeslices->len; i++) {
+        timeslice = g_array_index(wd->timeslices, xml_time*, i);
         if (timeslice &&
             timeslice->start == start_t && timeslice->end == end_t)
             return timeslice;
@@ -197,7 +197,7 @@ parse_location(xmlNode *cur_node,
 
 static void
 parse_time(xmlNode *cur_node,
-           xml_weather *data)
+           xml_weather *wd)
 {
     gchar *datatype, *from, *to;
     time_t start_t, end_t;
@@ -223,14 +223,14 @@ parse_time(xmlNode *cur_node,
         return;
 
     /* look for existing timeslice or add a new one */
-    timeslice = get_timeslice(data, start_t, end_t);
+    timeslice = get_timeslice(wd, start_t, end_t);
     if (! timeslice) {
         timeslice = g_slice_new0(xml_time);
         if (G_UNLIKELY(!timeslice))
             return;
         timeslice->start = start_t;
         timeslice->end = end_t;
-        g_array_append_val(data->timeslices, timeslice);
+        g_array_append_val(wd->timeslices, timeslice);
     }
 
     for (child_node = cur_node->children; child_node;
diff --git a/panel-plugin/weather-parsers.h b/panel-plugin/weather-parsers.h
index c832f36..d970632 100644
--- a/panel-plugin/weather-parsers.h
+++ b/panel-plugin/weather-parsers.h
@@ -131,7 +131,7 @@ xml_altitude *parse_altitude(xmlNode *cur_node);
 
 xml_timezone *parse_timezone(xmlNode *cur_node);
 
-xml_time *get_timeslice(xml_weather *data,
+xml_time *get_timeslice(xml_weather *wd,
                         const time_t start_t,
                         const time_t end_t);
 
@@ -142,7 +142,7 @@ gpointer parse_xml_document(SoupMessage *msg,
 
 void xml_time_free(xml_time *timeslice);
 
-void xml_weather_free(xml_weather *data);
+void xml_weather_free(xml_weather *wd);
 
 void xml_astro_free(xml_astro *astro);
 
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index a1ea3fa..29b7fb8 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -317,15 +317,15 @@ cb_weather_update(SoupSession *session,
                   gpointer user_data)
 {
     xfceweather_data *data = user_data;
-    xml_weather *weather = NULL;
+    xml_weather *wd = NULL;
 
-    if ((weather = (xml_weather *)
+    if ((wd = (xml_weather *)
          parse_xml_document(msg, (XmlParseFunc) parse_weather))) {
         if (G_LIKELY(data->weatherdata)) {
             weather_debug("Freeing weather data.");
             xml_weather_free(data->weatherdata);
         }
-        data->weatherdata = weather;
+        data->weatherdata = wd;
         data->last_data_update = time(NULL);
     }
     weather_debug("Updating current conditions.");


More information about the Xfce4-commits mailing list