From: Christian Goeschel Ndjomouo Date: Sun, 29 Mar 2026 18:00:36 +0000 (-0400) Subject: islocal: use less ambiguous variable name X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd98fa32637ff7d3404af2c6282a9d2ab6cf0510;p=thirdparty%2Futil-linux.git islocal: use less ambiguous variable name The variable name 'match' naturally implies a binary state e.g. true or false and is not appropriate for the indexing of a string literal, it is better to avoid this ambiguity and use a name that properly conveys its purpose, in this case 'idx' is a better choice. Signed-off-by: Christian Goeschel Ndjomouo --- diff --git a/login-utils/islocal.c b/login-utils/islocal.c index 1adddd7cd..4012b6617 100644 --- a/login-utils/islocal.c +++ b/login-utils/islocal.c @@ -30,7 +30,7 @@ static int is_local_in_file(const char *user, const char *filename) { int local = 0; - size_t match; + size_t idx; int chin, skip; FILE *f; @@ -38,7 +38,7 @@ static int is_local_in_file(const char *user, const char *filename) if (!f) return -1; - match = 0; + idx = 0; skip = 0; while ((chin = fgetc(f)) != EOF) { if (skip) { @@ -46,11 +46,11 @@ static int is_local_in_file(const char *user, const char *filename) if (chin == '\n') { /* Start matching username at the next char. */ skip = 0; - match = 0; + idx = 0; } } else { if (chin == ':') { - if (user[match] == '\0') { + if (user[idx] == '\0') { /* Success. */ local = 1; /* next line has no test coverage, @@ -66,12 +66,12 @@ static int is_local_in_file(const char *user, const char *filename) /* This line contains no colon; it's * malformed. No skip since we are already * at the start of the next line. */ - match = 0U; - } else if (chin != user[match]) { + idx = 0; + } else if (chin != user[idx]) { /* username does not match. */ skip = 1; } else { - ++match; + ++idx; } } }