[PATCH 2/2] lib: glob: replace bitwise OR with logical operation on boolean
From: Josh Law
Date: Sun Mar 01 2026 - 10:22:13 EST
Using bitwise OR (|=) on a boolean variable is valid C, but replacing it with a direct logical assignment makes the intent clearer and appeases strict static analysis tools.
Signed-off-by: Josh Law <objecting@xxxxxxxxxxxxx>
---
lib/glob.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/glob.c b/lib/glob.c
index 902b5037a0a8..afff28285bd4 100644
--- a/lib/glob.c
+++ b/lib/glob.c
@@ -96,7 +96,8 @@ bool __pure glob_match(char const *pat, char const *str)
class += 2;
/* Any special action if a > b? */
}
- match |= (a <= c && c <= b);
+ if (a <= c && c <= b)
+ match = true;
} while ((a = *class++) != ']');
if (match == inverted)
--
2.43.0