Re: [PATCH 2/2] lib: glob: replace bitwise OR with logical operation on boolean

From: Kuan-Wei Chiu

Date: Sun Mar 01 2026 - 21:56:58 EST


Hi Josh,

On Sun, Mar 01, 2026 at 03:21:42PM +0000, Josh Law wrote:
> 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>

checkpath.pl reported the following warnings:

WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?)
#81:
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.

WARNING: From:/Signed-off-by: email address mismatch: 'From: Josh Law <hlcj1234567@xxxxxxxxx>' != 'Signed-off-by: Josh Law <objecting@xxxxxxxxxxxxx>'

total: 0 errors, 2 warnings, 0 checks, 9 lines checked

Regards,
Kuan-Wei

> ---
> 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
>
>