RE: [EXT] [PATCH v3 6/6] add-patch: reset "permitted" at loop start
From: Windl, Ulrich <hidden>
Date: 2025-10-31 10:28:50
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).
-----Original Message----- From: René Scharfe <redacted> Sent: Monday, October 6, 2025 7:24 PM To: git@vger.kernel.org Cc: Windl, Ulrich <redacted>; Junio C Hamano <redacted>; Phillip Wood [off-list ref] Subject: [EXT] [PATCH v3 6/6] add-patch: reset "permitted" at loop start
[...]
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