summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2013-07-10 11:13:38 +0100
committerDavid Mitchell <davem@iabyn.com>2013-07-28 10:33:37 +0100
commit8ef97b0e2cbc807a7da236464dc71e39332d8a62 (patch)
treee91d4bab51330d9263707d9630fc9312fcf4fc9d /pp_hot.c
parent03c83e260b8bf6c564b49840536ccd6f47a794ac (diff)
downloadperl-8ef97b0e2cbc807a7da236464dc71e39332d8a62.tar.gz
pp_match: simplify pos()-getting code
The previous commit removed the \G handling from pp_match; most of what's left in that code block is redundant code that just sets curpos under all conditions. So tidy it up.
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/pp_hot.c b/pp_hot.c
index ee740c21fb..d1111fab1d 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1383,24 +1383,17 @@ PP(pp_match)
goto nope;
}
- /* XXXX What part of this is needed with true \G-support? */
+ /* get pos() if //g */
if (global) {
- MAGIC * const mg = mg_find_mglob(TARG);
- if (mg && mg->mg_len >= 0) {
- if (!(RX_EXTFLAGS(rx) & RXf_GPOS_SEEN))
- curpos = mg->mg_len;
- else if (RX_EXTFLAGS(rx) & RXf_ANCH_GPOS) {
- curpos = mg->mg_len;
- }
- else if (!(RX_EXTFLAGS(rx) & RXf_GPOS_FLOAT))
- curpos = mg->mg_len;
- else
- curpos = mg->mg_len;
- /* last time pos() was set, it was zero-length match */
- if (mg->mg_flags & MGf_MINMATCH)
- had_zerolen = 1;
- }
+ MAGIC * const mg = mg_find_mglob(TARG);
+ if (mg && mg->mg_len >= 0) {
+ curpos = mg->mg_len;
+ /* last time pos() was set, it was zero-length match */
+ if (mg->mg_flags & MGf_MINMATCH)
+ had_zerolen = 1;
+ }
}
+
#ifdef PERL_SAWAMPERSAND
if ( RX_NPARENS(rx)
|| PL_sawampersand