summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Law <objecting@objecting.org>2026-03-01 23:38:45 +0300
committerAndrew Morton <akpm@linux-foundation.org>2026-03-28 07:19:38 +0300
commit90c73d0bfa36ea80f3a55f5426daa46fa2795957 (patch)
tree90809897364b5a5fcdaef0d245c931220a24be89
parent33a3dd9bfd410044225aa9f812102055d0e21d59 (diff)
downloadlinux-90c73d0bfa36ea80f3a55f5426daa46fa2795957.tar.xz
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>
-rw-r--r--lib/glob.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/glob.c b/lib/glob.c
index 877bdd0884a6..69311568ad3d 100644
--- a/lib/glob.c
+++ b/lib/glob.c
@@ -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++;
/*