[systemd-devel] [PATCH 5/5] test-strv : Fix shadowing compilation warning

philippedeswert at gmail.com philippedeswert at gmail.com
Thu Oct 16 14:43:53 PDT 2014


From: Philippe De Swert <philippedeswert at gmail.com>

Remove the following warning during compilation:
src/test/test-strv.c: In function ‘test_strv_quote_unquote’:
src/test/test-strv.c:140:56: warning: declaration of ‘split’ shadows a global declaration [-Wshadow]
In file included from src/test/test-strv.c:25:0:
./src/shared/util.h:248:13: warning: shadowed declaration is here [-Wshadow]
---
 src/test/test-strv.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/test/test-strv.c b/src/test/test-strv.c
index bbfe306..ee19f29 100644
--- a/src/test/test-strv.c
+++ b/src/test/test-strv.c
@@ -137,13 +137,13 @@ static void test_strv_join(void) {
         assert_se(streq(t, ""));
 }
 
-static void test_strv_quote_unquote(const char* const *split, const char *quoted) {
+static void test_strv_quote_unquote(const char* const *splitted, const char *quoted) {
         _cleanup_free_ char *p;
         _cleanup_strv_free_ char **s;
         char **t;
         int r;
 
-        p = strv_join_quoted((char **)split);
+        p = strv_join_quoted((char **)splitted);
         assert_se(p);
         printf("-%s- --- -%s-\n", p, quoted); /* fprintf deals with NULL, puts does not */
         assert_se(p);
@@ -154,8 +154,8 @@ static void test_strv_quote_unquote(const char* const *split, const char *quoted
         assert_se(s);
         STRV_FOREACH(t, s) {
                 assert_se(*t);
-                assert_se(streq(*t, *split));
-                split++;
+                assert_se(streq(*t, *splitted));
+                splitted++;
         }
 }
 
-- 
1.8.3.2



More information about the systemd-devel mailing list