Re: [PATCH 1/3] wildmatch: make dowild() take arbitrary flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nguyễn Thái Ngọc Duy  <pclouds@xxxxxxxxx> writes:

> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
> ---
>  wildmatch.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/wildmatch.c b/wildmatch.c
> index 3972e26..9586ed9 100644
> --- a/wildmatch.c
> +++ b/wildmatch.c
> @@ -55,7 +55,7 @@ typedef unsigned char uchar;
>  #define ISXDIGIT(c) (ISASCII(c) && isxdigit(c))
>  
>  /* Match pattern "p" against "text" */
> -static int dowild(const uchar *p, const uchar *text, int force_lower_case)
> +static int dowild(const uchar *p, const uchar *text, int flags)

It may be better to declare a bitset like this unsigned.

>  {
>  	uchar p_ch;
>  
> @@ -64,9 +64,9 @@ static int dowild(const uchar *p, const uchar *text, int force_lower_case)
>  		uchar t_ch, prev_ch;
>  		if ((t_ch = *text) == '\0' && p_ch != '*')
>  			return ABORT_ALL;
> -		if (force_lower_case && ISUPPER(t_ch))
> +		if (flags & FNM_CASEFOLD && ISUPPER(t_ch))

Please add parentheses around bitwise-AND that is used as a boolean,
i.e.

	if ((flags & FNM_CASEFOLD) && ISUPPER(t_ch))

Less chance of confusion.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]