This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
S_regmatch(): combine CURLY_B_min/_known states
There are currently two similar backtracking states for simple
non-greedy pattern repeats:
CURLY_B_min
CURLY_B_min_known
the latter is a variant of the former for when the character which must
follow the repeat is known, e.g. /(...)*?X.../, which allows quick
skipping to the next viable position.
The code for the two cases:
case CURLY_B_min_fail:
case CURLY_B_min_known_fail:
share a lot of similarities. This commit merges the two states into a
single CURLY_B_min state, with an associated single CURLY_B_min_fail
fail state.
That one code block can handle both types, with a single
if (ST.c1 == CHRTEST_VOID) ...
test to choose between the two variant parts of the code.
This makes the code smaller and more maintainable, at the cost of one
extra test per backtrack.