s3/lib: clang: Fix 'Value stored to 'b' is never read'
authorNoel Power <noel.power@suse.com>
Wed, 10 Jul 2019 15:07:35 +0000 (16:07 +0100)
committerGary Lockyer <gary@samba.org>
Tue, 16 Jul 2019 22:52:24 +0000 (22:52 +0000)
Fixes:

source3/lib/substitute.c:516:7: warning: Value stored to 'b' is never read <--[clang]
        for (b = s = a_string; (p = strchr_m(s, '%')); s = a_string + (p - b)) {
             ^   ~~~~~~~~~~~~
source3/lib/substitute.c:709:7: warning: Value stored to 'b' is never read <--[clang]
        for (b = s = a_string; (p = strchr_m(s, '%')); s = a_string + (p - b)) {
             ^   ~~~~~~~~~~~~
source3/lib/substitute.c:811:7: warning: Value stored to 'b' is never read <--[clang]
        for (b = s = a_string; (p = strchr_m(s, '%')); s = a_string + (p - b)) {
             ^   ~~~~~~~~~~~~
3 warnings generated.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
source3/lib/substitute.c

index ea227c5ab68d3d4c5f9cdbb7608b6e0e0944c8e8..f8ca6f41cc1aa42b4a5e67d811ef09575c4b632b 100644 (file)
@@ -513,7 +513,7 @@ char *talloc_sub_basic(TALLOC_CTX *mem_ctx,
 
        tmp_ctx = talloc_stackframe();
 
-       for (b = s = a_string; (p = strchr_m(s, '%')); s = a_string + (p - b)) {
+       for (s = a_string; (p = strchr_m(s, '%')); s = a_string + (p - b)) {
 
                r = NULL;
                b = a_string;
@@ -706,7 +706,7 @@ char *talloc_sub_specified(TALLOC_CTX *mem_ctx,
                goto done;
        }
 
-       for (b = s = a_string; (p = strchr_m(s, '%')); s = a_string + (p - b)) {
+       for (s = a_string; (p = strchr_m(s, '%')); s = a_string + (p - b)) {
 
                b = a_string;
 
@@ -808,7 +808,7 @@ char *talloc_sub_advanced(TALLOC_CTX *ctx,
                return NULL;
        }
 
-       for (b = s = a_string; (p = strchr_m(s, '%')); s = a_string + (p - b)) {
+       for (s = a_string; (p = strchr_m(s, '%')); s = a_string + (p - b)) {
 
                b = a_string;