[libgweather/wip/hadess/fixes: 10/13] gweather: Cleanup argument to _gweather_info_new_clone()




commit 0dd6b84b3bef5809a21e6609535a1c916e02be1c
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Jan 11 17:48:39 2021 +0100

    gweather: Cleanup argument to _gweather_info_new_clone()
    
    Was "info", "other" and "master_info" depending on the caller. Call
    them all "original" or "original_info".

 libgweather/gweather-private.h |  2 +-
 libgweather/gweather-weather.c |  6 +++---
 libgweather/weather-iwin.c     |  6 +++---
 libgweather/weather-metno.c    | 10 +++++-----
 libgweather/weather-owm.c      | 10 +++++-----
 5 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/libgweather/gweather-private.h b/libgweather/gweather-private.h
index 5f18e91d..f5ea83be 100644
--- a/libgweather/gweather-private.h
+++ b/libgweather/gweather-private.h
@@ -232,7 +232,7 @@ void            _gweather_info_ensure_moon (GWeatherInfo *info);
 
 void           free_forecast_list        (GWeatherInfo *info);
 
-GWeatherInfo   *_gweather_info_new_clone  (GWeatherInfo *info);
+GWeatherInfo   *_gweather_info_new_clone  (GWeatherInfo *original);
 
 #endif /* __WEATHER_PRIV_H_ */
 
diff --git a/libgweather/gweather-weather.c b/libgweather/gweather-weather.c
index 918bc8ab..3d181712 100644
--- a/libgweather/gweather-weather.c
+++ b/libgweather/gweather-weather.c
@@ -2264,11 +2264,11 @@ gweather_info_new (GWeatherLocation *location)
 }
 
 GWeatherInfo *
-_gweather_info_new_clone (GWeatherInfo *other)
+_gweather_info_new_clone (GWeatherInfo *original)
 {
     return g_object_new (GWEATHER_TYPE_INFO,
-                         "location", other->glocation,
-                         "enabled-providers", other->providers,
+                         "location", original->glocation,
+                         "enabled-providers", original->providers,
                          NULL);
 }
 
diff --git a/libgweather/weather-iwin.c b/libgweather/weather-iwin.c
index e0115300..d5e0aae9 100644
--- a/libgweather/weather-iwin.c
+++ b/libgweather/weather-iwin.c
@@ -50,13 +50,13 @@ hasAttr (xmlNode *node, const char *attr_name, const char *attr_value)
 }
 
 static GSList *
-parseForecastXml (const char *buff, GWeatherInfo *master_info)
+parseForecastXml (const char *buff, GWeatherInfo *original_info)
 {
     GSList *res = NULL;
     xmlDocPtr doc;
     xmlNode *root, *node;
 
-    g_return_val_if_fail (master_info != NULL, NULL);
+    g_return_val_if_fail (original_info != NULL, NULL);
 
     if (!buff || !*buff)
         return NULL;
@@ -133,7 +133,7 @@ parseForecastXml (const char *buff, GWeatherInfo *master_info)
                         int i;
 
                         for (i = 0; i < 7;  i++) {
-                            GWeatherInfo *nfo = _gweather_info_new_clone (master_info);
+                            GWeatherInfo *nfo = _gweather_info_new_clone (original_info);
                            nfo->current_time = nfo->update = update_times[i];
 
                             if (nfo)
diff --git a/libgweather/weather-metno.c b/libgweather/weather-metno.c
index 1206be4a..fa5e012d 100644
--- a/libgweather/weather-metno.c
+++ b/libgweather/weather-metno.c
@@ -303,7 +303,7 @@ fill_info_from_node (GWeatherInfo *info,
 }
 
 static void
-parse_forecast_xml_new (GWeatherInfo    *master_info,
+parse_forecast_xml_new (GWeatherInfo    *original_info,
                        SoupMessageBody *body)
 {
     xmlDocPtr doc;
@@ -331,11 +331,11 @@ parse_forecast_xml_new (GWeatherInfo    *master_info,
        node = xpath_result->nodesetval->nodeTab[i];
 
        val = xmlGetProp (node, XC("from"));
-       from_time = date_to_time_t (val, master_info->location.tz_hint);
+       from_time = date_to_time_t (val, original_info->location.tz_hint);
        xmlFree (val);
 
        val = xmlGetProp (node, XC("to"));
-       to_time = date_to_time_t (val, master_info->location.tz_hint);
+       to_time = date_to_time_t (val, original_info->location.tz_hint);
        xmlFree (val);
 
        /* New API has forecast in a list of "master" elements
@@ -347,7 +347,7 @@ parse_forecast_xml_new (GWeatherInfo    *master_info,
           <location> element inside each <time> element.
        */
        if (from_time == to_time) {
-           info = _gweather_info_new_clone (master_info);
+           info = _gweather_info_new_clone (original_info);
            info->current_time = info->update = from_time;
 
            for (location = node->children;
@@ -379,7 +379,7 @@ parse_forecast_xml_new (GWeatherInfo    *master_info,
 
        That's very nice of them!
     */
-    master_info->forecast_attribution = g_strdup(_("Weather data from the <a 
href=\"https://www.met.no/\";>Norwegian Meteorological Institute</a>."));
+    original_info->forecast_attribution = g_strdup(_("Weather data from the <a 
href=\"https://www.met.no/\";>Norwegian Meteorological Institute</a>."));
 
  out:
     xmlXPathFreeContext (xpath_ctx);
diff --git a/libgweather/weather-owm.c b/libgweather/weather-owm.c
index 2663f60b..e756fe3a 100644
--- a/libgweather/weather-owm.c
+++ b/libgweather/weather-owm.c
@@ -336,7 +336,7 @@ fill_info_from_node (GWeatherInfo *info,
 }
 
 static GWeatherInfo *
-make_info_from_node (GWeatherInfo *master_info,
+make_info_from_node (GWeatherInfo *original_info,
                      xmlNodePtr    node)
 {
     GWeatherInfo *info;
@@ -344,7 +344,7 @@ make_info_from_node (GWeatherInfo *master_info,
 
     g_return_val_if_fail (node->type == XML_ELEMENT_NODE, NULL);
 
-    info = _gweather_info_new_clone (master_info);
+    info = _gweather_info_new_clone (original_info);
 
     val = xmlGetProp (node, XC("from"));
     info->current_time = info->update = date_to_time_t (val, info->location.tz_hint);
@@ -356,7 +356,7 @@ make_info_from_node (GWeatherInfo *master_info,
 }
 
 static void
-parse_forecast_xml (GWeatherInfo    *master_info,
+parse_forecast_xml (GWeatherInfo    *original_info,
                     SoupMessageBody *body)
 {
     xmlDocPtr doc;
@@ -379,7 +379,7 @@ parse_forecast_xml (GWeatherInfo    *master_info,
        GWeatherInfo *info;
 
        node = xpath_result->nodesetval->nodeTab[i];
-       info = make_info_from_node (master_info, node);
+       info = make_info_from_node (original_info, node);
 
        info->forecast_list = g_slist_append (info->forecast_list, info);
     }
@@ -390,7 +390,7 @@ parse_forecast_xml (GWeatherInfo    *master_info,
     if (!xpath_result || xpath_result->type != XPATH_NODESET)
        goto out;
 
-    master_info->forecast_attribution = g_strdup(_("Weather data from the <a 
href=\"https://openweathermap.org\";>Open Weather Map project</a>"));
+    original_info->forecast_attribution = g_strdup(_("Weather data from the <a 
href=\"https://openweathermap.org\";>Open Weather Map project</a>"));
 
  out:
     if (xpath_result)


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