[libgweather/improve-build: 5/7] Fix shadowed variable



commit 353975932806f050e347cfc219925e7109f3eabc
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Mar 9 13:26:24 2020 +0000

    Fix shadowed variable
    
    The global `search_str` is not used: we pass it as an argument to each
    function that would use it.

 libgweather/test_weather.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/libgweather/test_weather.c b/libgweather/test_weather.c
index 832dee0..a8dbf8b 100644
--- a/libgweather/test_weather.c
+++ b/libgweather/test_weather.c
@@ -4,7 +4,6 @@
 
 #include <locale.h>
 
-static char *search_str;
 // gnome-weather uses:
 static GWeatherProvider providers = GWEATHER_PROVIDER_METAR | GWEATHER_PROVIDER_YR_NO | 
GWEATHER_PROVIDER_OWM;
 
@@ -13,7 +12,7 @@ static GWeatherProvider providers = GWEATHER_PROVIDER_METAR | GWEATHER_PROVIDER_
 
 static gboolean
 find_loc_children (GWeatherLocation  *location,
-                  const char        *search_str,
+                  const char        *str,
                   GWeatherLocation **ret)
 {
     GWeatherLocation **children;
@@ -25,12 +24,12 @@ find_loc_children (GWeatherLocation  *location,
             const char *code;
 
             code = gweather_location_get_code (children[i]);
-            if (g_strcmp0 (search_str, code) == 0) {
+            if (g_strcmp0 (str, code) == 0) {
                 *ret = gweather_location_ref (children[i]);
                 return TRUE;
             }
         } else {
-            if (find_loc_children (children[i], search_str, ret))
+            if (find_loc_children (children[i], str, ret))
                 return TRUE;
         }
     }
@@ -40,11 +39,11 @@ find_loc_children (GWeatherLocation  *location,
 
 static GWeatherLocation *
 find_loc (GWeatherLocation *world,
-         const char       *search_str)
+         const char       *str)
 {
     GWeatherLocation *loc = NULL;
 
-    find_loc_children (world, search_str, &loc);
+    find_loc_children (world, str, &loc);
     return loc;
 }
 
@@ -136,6 +135,7 @@ main (int argc, char **argv)
     GWeatherLocation *world, *loc;
     GWeatherInfo *info;
     GMainLoop *loop;
+    const char *search_str;
 
     setlocale (LC_ALL, "");
 


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