RE: [EXT] [PATCH v3 6/6] add-patch: reset "permitted" at loop start
Just a comment of personal taste: I think declaring an anonymous enum inside a loop is just bad style. I think that gcc is smart enough to optimize if "permitted" is declared outside the loop, or make the "permitted" use a typedef for a "named enum" (declared outside the loop while the variable may be inside the loop).
Show 8 quoted lines
> -----Original Message-----
> From: René Scharfe <l.s.r@web.de>
> Sent: Monday, October 6, 2025 7:24 PM
> To: git@vger.kernel.org
> Cc: Windl, Ulrich <u.windl@ukr.de>; Junio C Hamano <gitster@pobox.com>;
> Phillip Wood <phillip.wood@dunelm.org.uk>
> Subject: [EXT] [PATCH v3 6/6] add-patch: reset "permitted" at loop start
>
Show 15 quoted lines
> for (;;) {
> + enum {
> + ALLOW_GOTO_PREVIOUS_HUNK = 1 << 0,
> + ALLOW_GOTO_PREVIOUS_UNDECIDED_HUNK = 1 <<
> 1,
> + ALLOW_GOTO_NEXT_HUNK = 1 << 2,
> + ALLOW_GOTO_NEXT_UNDECIDED_HUNK = 1 << 3,
> + ALLOW_SEARCH_AND_GOTO = 1 << 4,
> + ALLOW_SPLIT = 1 << 5,
> + ALLOW_EDIT = 1 << 6
> + } permitted = 0;
> +
> if (hunk_index >= file_diff->hunk_nr)
> hunk_index = 0;
> hunk = file_diff->hunk_nr