From 8ef97b0e2cbc807a7da236464dc71e39332d8a62 Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Wed, 10 Jul 2013 11:13:38 +0100 Subject: 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. --- pp_hot.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'pp_hot.c') 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 -- cgit v1.2.1