summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2013-07-15 21:57:34 +0100
committerDavid Mitchell <davem@iabyn.com>2013-07-28 10:33:39 +0100
commitfeb38e3b9dba8f9f75fe6c737d7c4d99ff1aca46 (patch)
tree1c633eb07e2c3bdf394ef1e0ad4c082c4a117a77 /pp_hot.c
parent2ec7214c34f5d160ff6a0e8acb3f151c5974e83a (diff)
downloadperl-feb38e3b9dba8f9f75fe6c737d7c4d99ff1aca46.tar.gz
pp_subst: don't use REXEC_COPY_STR on 2nd match
pp_subst() sets the REXEC_COPY_STR flag on the first match. On the second and subsequent matches, it doesn't set it in two out three of the branches (including pp_susbstcont) where it calls CALLREGEXEC(). The one place where it *does* set it is a (harmless) mistake, since regexec ignores REXEC_COPY_STR if REXEC_NOT_FIRST is set (which is it is, on all 3 brnanches). So unset REXEC_COPY_STR in the third branch too, for consistency
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 27ecb4a4ee..ee8267303b 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2283,7 +2283,6 @@ PP(pp_subst)
PUSHSUBST(cx);
RETURNOP(cPMOP->op_pmreplrootu.op_pmreplroot);
}
- r_flags |= REXEC_IGNOREPOS | REXEC_NOT_FIRST;
first = TRUE;
do {
if (iters++ > maxiters)
@@ -2322,7 +2321,7 @@ PP(pp_subst)
if (once)
break;
} while (CALLREGEXEC(rx, s, strend, orig, s == m,
- TARG, NULL, r_flags));
+ TARG, NULL, REXEC_NOT_FIRST|REXEC_IGNOREPOS));
sv_catpvn_nomg_maybeutf8(dstr, s, strend - s, DO_UTF8(TARG));
if (rpm->op_pmflags & PMf_NONDESTRUCT) {