summaryrefslogtreecommitdiff
path: root/compat/regex/regexec.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2025-03-27 11:53:00 +0000
committerJunio C Hamano <gitster@pobox.com>2025-03-28 17:38:11 -0700
commit752fe9dc929afe1944e44b852f1248df4fb82986 (patch)
tree04c5d896d6b43944ab7f475eae120f0aedf91524 /compat/regex/regexec.c
parentbe7a517ce4606b46479fe06fae6c1ab117b0d384 (diff)
wildmatch: avoid using of the comma operator
The comma operator is a somewhat obscure C feature that is often used by mistake and can even cause unintentional code flow. That is why the `-Wcomma` option of clang was introduced: To identify unintentional uses of the comma operator. In this instance, the usage is intentional because it allows storing the value of the current character as `prev_ch` before making the next character the current one, all of which happens in the loop condition that lets the loop stop at a closing bracket. However, it is hard to read. The chosen alternative to using the comma operator is to move those assignments from the condition into the loop body; In this particular case that requires special care because the loop body contains a `continue` for the case where a character class is found that starts with `[:` but does not end in `:]` (and the assignments should occur even when that code path is taken), which needs to be turned into a `goto`. Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/regex/regexec.c')
0 files changed, 0 insertions, 0 deletions