pp_match(): don't set REXEC_IGNOREPOS on 1st iter
authorDavid Mitchell <davem@iabyn.com>
Sat, 22 Jun 2013 16:24:13 +0000 (17:24 +0100)
committerDavid Mitchell <davem@iabyn.com>
Sun, 28 Jul 2013 09:33:36 +0000 (10:33 +0100)
Currently all core callers of regexec set both the
REXEC_IGNOREPOS and REXEC_NOT_FIRST flags, or neither, depending
on whether this is the first or subsequent iteration of a //g;
*except* for one place in pp_match(), where REXEC_IGNOREPOS is set
on the first iteration for the one specific case of /g with an anchored
\G.

Now AFAICT this makes no difference, because the starting position
as calculated by regexec() still comes to the same value of
(strbeg + pos -gofs), and the same value og ganch calculated.

Also in the commit that added this particular use of the flag to pp_match,
(0ef3e39ecdfec), removing the flag makes no difference to the passing or
not of the new test case.

So I don't understand what its purpose it, and its possibly a mistake.
Removing it now makes the code simpler for further clearup.

pp_hot.c

index 964a7cd..bf4aca7 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1392,7 +1392,6 @@ PP(pp_match)
                if (!(RX_EXTFLAGS(rx) & RXf_GPOS_SEEN))
                    curpos = mg->mg_len;
                else if (RX_EXTFLAGS(rx) & RXf_ANCH_GPOS) {
-                   r_flags |= REXEC_IGNOREPOS;
                    curpos = mg->mg_len;
                }
                else if (!(RX_EXTFLAGS(rx) & RXf_GPOS_FLOAT))