summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2013-06-20 14:54:44 +0100
committerDavid Mitchell <davem@iabyn.com>2013-07-28 10:33:36 +0100
commitd058ec57a827a21938e4726983d892ff9054dab3 (patch)
treebb7e22dc40105eb813be92ecb6d711db2004ef20 /pp_hot.c
parent9c13586e8887c0bcb29d89d3d73a7828043e999c (diff)
downloadperl-d058ec57a827a21938e4726983d892ff9054dab3.tar.gz
pp_match(): skip passing gpos arg to regexec()
In one specific case, pp_match() passes the value of pos() to regexec() via the otherwise unused 'data' arg. It turns out that pp_match() only passes this value when it exists and is >= 0, while regexec() only uses it when there's no pos magic or pos() < 0. So its never used as far as I can tell. So, strip it for now.
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/pp_hot.c b/pp_hot.c
index e0a543c8ef..9a1beab4af 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1334,7 +1334,6 @@ PP(pp_match)
const I32 oldsave = PL_savestack_ix;
I32 update_minmatch = 1;
I32 had_zerolen = 0;
- U32 gpos = 0;
if (PL_op->op_flags & OPf_STACKED)
TARG = POPs;
@@ -1398,9 +1397,8 @@ PP(pp_match)
else if (RX_EXTFLAGS(rx) & RXf_ANCH_GPOS) {
r_flags |= REXEC_IGNOREPOS;
RX_OFFS(rx)[0].end = RX_OFFS(rx)[0].start = mg->mg_len;
- } else if (RX_EXTFLAGS(rx) & RXf_GPOS_FLOAT)
- gpos = mg->mg_len;
- else
+ }
+ else if (!(RX_EXTFLAGS(rx) & RXf_GPOS_FLOAT))
RX_OFFS(rx)[0].end = RX_OFFS(rx)[0].start = mg->mg_len;
minmatch = (mg->mg_flags & MGf_MINMATCH) ? RX_GOFS(rx) + 1 : 0;
update_minmatch = 0;
@@ -1434,7 +1432,7 @@ PP(pp_match)
}
if (!CALLREGEXEC(rx, (char*)s, (char *)strend, (char*)truebase,
- minmatch, TARG, NUM2PTR(void*, gpos), r_flags))
+ minmatch, TARG, NULL, r_flags))
goto nope;
PL_curpm = pm;