summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2013-07-10 13:35:51 +0100
committerDavid Mitchell <davem@iabyn.com>2013-07-28 10:33:37 +0100
commit23a56f329b4aaaf3e9197ba8e1c6b3edc53743ed (patch)
tree45cc76a5854b3672b5a88490f5445133e0007aaf /regexec.c
parent8ef97b0e2cbc807a7da236464dc71e39332d8a62 (diff)
downloadperl-23a56f329b4aaaf3e9197ba8e1c6b3edc53743ed.tar.gz
regexec_flags(): use result of intuit_start()
When I moved the call to re_intuit_start() into Perl_regexec_flags() a few commits earlier, I assigned the return value to the wrong variable, so a subsequent match would still start at the beginning, not at the intuited start point. This commit corrects that, by updating startpos rather than stringarg.
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/regexec.c b/regexec.c
index b05b1521a0..6aacd0b257 100644
--- a/regexec.c
+++ b/regexec.c
@@ -2278,9 +2278,9 @@ Perl_regexec_flags(pTHX_ REGEXP * const rx, char *stringarg, char *strend,
if ((RX_EXTFLAGS(rx) & RXf_USE_INTUIT)
&& !(flags & REXEC_CHECKED))
{
- stringarg = re_intuit_start(rx, sv, strbeg, stringarg, strend,
+ startpos = re_intuit_start(rx, sv, strbeg, stringarg, strend,
flags, NULL);
- if (!stringarg)
+ if (!startpos)
return 0;
if (RX_EXTFLAGS(rx) & RXf_CHECK_ALL) {
@@ -2297,10 +2297,10 @@ Perl_regexec_flags(pTHX_ REGEXP * const rx, char *stringarg, char *strend,
strbeg, strend,
sv, flags, utf8_target);
- prog->offs[0].start = stringarg - strbeg;
+ prog->offs[0].start = startpos - strbeg;
prog->offs[0].end = utf8_target
- ? (char*)utf8_hop((U8*)stringarg, prog->minlenret) - strbeg
- : stringarg - strbeg + prog->minlenret;
+ ? (char*)utf8_hop((U8*)startpos, prog->minlenret) - strbeg
+ : startpos - strbeg + prog->minlenret;
return 1;
}
}
@@ -2338,7 +2338,7 @@ Perl_regexec_flags(pTHX_ REGEXP * const rx, char *stringarg, char *strend,
reginfo->poscache_maxiter = 0; /* not yet started a countdown */
reginfo->strend = strend;
/* see how far we have to get to not match where we matched before */
- reginfo->till = startpos+minend;
+ reginfo->till = stringarg + minend;
if (prog->extflags & RXf_EVAL_SEEN && SvPADTMP(sv) && !IS_PADGV(sv)) {
/* SAVEFREESV, not sv_mortalcopy, as this SV must last until after