summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2018-12-02 17:45:06 -0700
committerKarl Williamson <khw@cpan.org>2018-12-07 21:12:16 -0700
commit326e89a8f626e8d34cef67843ff00bb29236368e (patch)
tree2f878d852d636348591d80b0d145f00cf1c811e3
parent979c312ebbf9f0c1146d8cb2d8402412a97315c7 (diff)
downloadperl-326e89a8f626e8d34cef67843ff00bb29236368e.tar.gz
regcomp.c: Move clause of while() conditional into loop
This is in preparation for making the conditional more complicated than can be easily done in the condition.
-rw-r--r--regcomp.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/regcomp.c b/regcomp.c
index 1c7063c44a..300c608262 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -3957,9 +3957,9 @@ S_join_exact(pTHX_ RExC_state_t *pRExC_state, regnode *scan,
/* Look through the subsequent nodes in the chain. Skip NOTHING, merge
* EXACT ones that are mergeable to the current one. */
- while (n
- && (PL_regkind[OP(n)] == NOTHING
- || (stringok && OP(n) == OP(scan)))
+ while ( n
+ && ( PL_regkind[OP(n)] == NOTHING
+ || (stringok && PL_regkind[OP(n)] == EXACT))
&& NEXT_OFF(n)
&& NEXT_OFF(scan) + NEXT_OFF(n) < I16_MAX)
{
@@ -3987,6 +3987,10 @@ S_join_exact(pTHX_ RExC_state_t *pRExC_state, regnode *scan,
if (oldl + STR_LEN(n) > U8_MAX)
break;
+ if (OP(scan) != OP(n)) {
+ break;
+ }
+
DEBUG_PEEP("merg", n, depth, 0);
merged++;