Subject: Re: [PATCH v2 07/10] wildmatch: explicitly mark intentional use of the comma operator

From: Junio C Hamano <[email-masked]>
Date: Wed, 26 Mar 2025 03:34:08 -0700

Phillip Wood <[email-masked]> writes:

> I think that would be clearer, something like the diff below
>
> Best Wishes
>
> Phillip
>
> ---- >8 ----
>
> diff --git a/wildmatch.c b/wildmatch.c
> index 8ea29141bd7..7230544c356 100644
> --- a/wildmatch.c
> +++ b/wildmatch.c
> @@ -223,7 +223,7 @@
>  						p_ch = '[';
>  						if (t_ch == p_ch)
>  							matched = 1;
> -						continue;
> +						goto next;
>  					}
>  					if (CC_EQ(s,i, "alnum")) {
>  						if (ISALNUM(t_ch))
> @@ -268,7 +268,10 @@
>  					p_ch = 0; /* This makes "prev_ch" get set to 0. */
>  				} else if (t_ch == p_ch)
>  					matched = 1;
> -			} while (prev_ch = p_ch, (p_ch = *++p) != ']');
> +			next:
> +				prev_ch = p_ch;
> +				p_ch = *++p;
> +			} while (p_ch != ']');
>  			if (matched == negated ||
>  			    ((flags & WM_PATHNAME) && t_ch == '/'))
>  				return WM_NOMATCH;
>

Ah, I missed that "continue"; with the "next:" label, it looks quite
clear what is going on.

I like it.  Thanks.