* [PATCH] lib/glob: clean up "bool abuse" in pointer arithmetic
@ 2026-03-01 20:38 Josh Law
0 siblings, 0 replies; only message in thread
From: Josh Law @ 2026-03-01 20:38 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Josh Law
From: Josh Law <objecting@objecting.org>
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.
Signed-off-by: Josh Law <objecting@objecting.org>
---
lib/glob.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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++;
/*
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-03-01 20:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-01 20:38 [PATCH] lib/glob: clean up "bool abuse" in pointer arithmetic Josh Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox