re_intuit_start(): simplify the /^.../m condition
authorDavid Mitchell <davem@iabyn.com>
Tue, 4 Feb 2014 21:01:58 +0000 (21:01 +0000)
committerDavid Mitchell <davem@iabyn.com>
Sat, 8 Feb 2014 13:50:22 +0000 (13:50 +0000)
The commit-but-last merged two conditions into a single messy one; now
simplify it.
Note that in the case of /.*.../, which sets MBOL and IMPLICIT,
we should never arrive with strpos != rx_origin, since the .* forces
the origin as far back as it will go.

regexec.c

index 24a6826..670ff0b 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -1089,11 +1089,9 @@ Perl_re_intuit_start(pTHX_
 
     /* handle the extra constraint of /^/m  */
 
-    if (   ((rx_origin != strpos) && (ml_anch && rx_origin[-1] != '\n'))
-        || ((rx_origin == strpos) &&
-                (ml_anch && (strpos != strbeg) && strpos[-1] != '\n'
-                    /* May be due to an implicit anchor of m{.*foo}  */
-           && !(prog->intflags & PREGf_IMPLICIT))))
+    if (ml_anch && rx_origin != strbeg && rx_origin[-1] != '\n'
+        /* May be due to an implicit anchor of m{.*foo}  */
+        && !(prog->intflags & PREGf_IMPLICIT))
     {
         char *t;