lib/glob: clean up "bool abuse" in pointer arithmetic

Replace the implicit 'bool' to 'int' conversion with an explicit ternary
operator.  This makes the pointer arithmetic clearer and avoids relying on
boolean memory representation for logic flow.

Link: https://lkml.kernel.org/r/20260301203845.2617217-1-objecting@objecting.org
Signed-off-by: Josh Law <objecting@objecting.org>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
Josh Law 2026-03-01 20:38:45 +00:00 committed by Andrew Morton
parent 33a3dd9bfd
commit 90c73d0bfa

View File

@ -73,7 +73,7 @@ bool __pure glob_match(char const *pat, char const *str)
if (c == '\0') /* No possible match */
return false;
bool match = false, inverted = (*pat == '!');
char const *class = pat + inverted;
char const *class = inverted ? pat + 1 : pat;
unsigned char a = *class++;
/*