From: Andrew Tridgell Date: Mon, 15 Jun 2026 20:43:20 +0000 (+1000) Subject: scan-build: drop dead assignments X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8118744f2a87bf286d5d1961b3dfff9484261989;p=thirdparty%2Frsync.git scan-build: drop dead assignments 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 --- diff --git a/batch.c b/batch.c index 878b6dd1..c2ef85ea 100644 --- 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); diff --git a/options.c b/options.c index 3c2d2352..8568af2b 100644 --- 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; diff --git a/simd-checksum-x86_64.cpp b/simd-checksum-x86_64.cpp index 7b0a7546..da48a7d3 100644 --- a/simd-checksum-x86_64.cpp +++ b/simd-checksum-x86_64.cpp @@ -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 7a1f24b5..d9d9f4bc 100644 --- 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",