diff options
author | David Mitchell <davem@iabyn.com> | 2013-06-21 21:44:45 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2013-07-28 10:33:36 +0100 |
commit | 9c2cf4937b5a5b262dede4eb956723ce43137ac7 (patch) | |
tree | 38772cf668a13c904aea3928efa3c020637692ed /pp_hot.c | |
parent | 0e0b3e821b5e521a335daca058798c20db3eae06 (diff) | |
download | perl-9c2cf4937b5a5b262dede4eb956723ce43137ac7.tar.gz |
pp_match(): stop setting $-[0] before regexec()
It doesn't actually achieve anything.
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1388,16 +1388,15 @@ PP(pp_match) /* XXXX What part of this is needed with true \G-support? */ if (global) { MAGIC * const mg = mg_find_mglob(TARG); - RX_OFFS(rx)[0].start = -1; if (mg && mg->mg_len >= 0) { if (!(RX_EXTFLAGS(rx) & RXf_GPOS_SEEN)) - curpos = RX_OFFS(rx)[0].start = mg->mg_len; + curpos = mg->mg_len; else if (RX_EXTFLAGS(rx) & RXf_ANCH_GPOS) { r_flags |= REXEC_IGNOREPOS; - curpos = RX_OFFS(rx)[0].start = mg->mg_len; + curpos = mg->mg_len; } else if (!(RX_EXTFLAGS(rx) & RXf_GPOS_FLOAT)) - curpos = RX_OFFS(rx)[0].start = mg->mg_len; + curpos = mg->mg_len; minmatch = (mg->mg_flags & MGf_MINMATCH) ? RX_GOFS(rx) + 1 : 0; update_minmatch = 0; } @@ -1421,7 +1420,7 @@ PP(pp_match) s = truebase; play_it_again: - if (global && RX_OFFS(rx)[0].start != -1) { + if (global) { s = truebase + curpos - RX_GOFS(rx); if ((s + RX_MINLEN(rx)) > strend || s < truebase) { DEBUG_r(PerlIO_printf(Perl_debug_log, "Regex match can't succeed, so not even tried\n")); @@ -1495,6 +1494,7 @@ PP(pp_match) } } if (global) { + assert(RX_OFFS(rx)[0].start != -1); curpos = (UV)RX_OFFS(rx)[0].end; had_zerolen = (RX_OFFS(rx)[0].start != -1 && (RX_OFFS(rx)[0].start + RX_GOFS(rx) |