Re: [PATCH v2 07/10] wildmatch: explicitly mark intentional use of the comma operator
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 26, 2025, 10:34 UTC
- Message-ID
- <xmqqtt7ghyhr.fsf@gitster.g>
- In-Reply-To
- <a7506e7b-f86f-426c-b816-540be282518b@gmail.com>
Phillip Wood <phillip.wood123@gmail.com> writes:
Show 34 quoted lines
> 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.