]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
scan-build: drop dead assignments
authorAndrew Tridgell <andrew@tridgell.net>
Mon, 15 Jun 2026 20:43:20 +0000 (06:43 +1000)
committerAndrew Tridgell <andrew@tridgell.net>
Mon, 15 Jun 2026 22:55:39 +0000 (08:55 +1000)
Remove stores that are never read before being overwritten or going
out of scope. No behavior change except batch.c write_opt, which now
accumulates the leading-space write error into the return value
(consistent with the arg branch) instead of discarding it.

simd-checksum-x86_64.cpp, options.c, util1.c, batch.c

batch.c
options.c
simd-checksum-x86_64.cpp
util1.c

diff --git a/batch.c b/batch.c
index 878b6dd1d156e4d7444d942f89892c4be37b0d70..c2ef85ea2ffd14c1a6b3191987dca04c251fd029 100644 (file)
--- a/batch.c
+++ b/batch.c
@@ -194,7 +194,7 @@ static int write_opt(const char *opt, const char *arg)
 {
        int len = strlen(opt);
        int err = write(batch_sh_fd, " ", 1) != 1;
-       err = write(batch_sh_fd, opt, len) != len ? 1 : 0;
+       err |= write(batch_sh_fd, opt, len) != len;
        if (arg) {
                err |= write(batch_sh_fd, "=", 1) != 1;
                err |= write_arg(arg);
index 3c2d235261ad9755d470030b9939f4565cdc9e36..8568af2b2fdbf7fe4d1805ff26a2096ca1e4e8a7 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1489,7 +1489,6 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                                *argc_p = 0;
                        } else if (poptDupArgv(argc, argv, argc_p, argv_p) != 0)
                                out_of_memory("parse_arguments");
-                       argv = *argv_p;
                        poptFreeContext(pc);
 
                        am_starting_up = 0;
index 7b0a75462c653c6d769868b31ad72152890509c0..da48a7d3453533daf3ef8d9fc35e0bc6341417a6 100644 (file)
@@ -488,8 +488,8 @@ static inline uint32 get_checksum1_cpp(char *buf1, int32 len)
     // multiples of 32 bytes using SSE2 (if available)
     i = get_checksum1_sse2_32((schar*)buf1, len, i, &s1, &s2);
 
-    // whatever is left
-    i = get_checksum1_default_1((schar*)buf1, len, i, &s1, &s2);
+    // whatever is left (updates s1/s2; the returned offset is unused here)
+    get_checksum1_default_1((schar*)buf1, len, i, &s1, &s2);
 
     return (s1 & 0xffff) + (s2 << 16);
 }
diff --git a/util1.c b/util1.c
index 7a1f24b54e0d62f0b8cc1be03efef250961a4e99..d9d9f4bcf072ca50d1800db357486ee46ba8b8cc 100644 (file)
--- a/util1.c
+++ b/util1.c
@@ -524,7 +524,7 @@ int robust_unlink(const char *fname)
                snprintf(&path[pos], MAX_RENAMES_DIGITS+1, "%03d", counter);
                if (++counter >= MAX_RENAMES)
                        counter = 1;
-       } while ((rc = access(path, 0)) == 0 && counter != start);
+       } while (access(path, 0) == 0 && counter != start);
 
        if (INFO_GTE(MISC, 1)) {
                rprintf(FWARNING, "renaming %s to %s because of text busy\n",