summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2013-06-21 21:44:45 +0100
committerDavid Mitchell <davem@iabyn.com>2013-07-28 10:33:36 +0100
commit9c2cf4937b5a5b262dede4eb956723ce43137ac7 (patch)
tree38772cf668a13c904aea3928efa3c020637692ed /pp_hot.c
parent0e0b3e821b5e521a335daca058798c20db3eae06 (diff)
downloadperl-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.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 6e74b6e001..964a7cdac8 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -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)