re_intuit_start(): simplify ml_anch evaluation
authorDavid Mitchell <davem@iabyn.com>
Fri, 27 Dec 2013 23:23:12 +0000 (23:23 +0000)
committerDavid Mitchell <davem@iabyn.com>
Fri, 7 Feb 2014 22:39:36 +0000 (22:39 +0000)
rather than enumerating all the anchor flag combos where ml_anch *isn't*
true, enumerate the flags for which is *is* true. This is slighly simpler
logic, and involves once less negation, which makes it easier to
understand.

regexec.c

index 67b70c1..0d43d6b 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -677,10 +677,11 @@ Perl_re_intuit_start(pTHX_
         }
        check = prog->check_substr;
     }
+
     if (prog->intflags & PREGf_ANCH) { /* Match at \G, beg-of-str or after \n */
-        ml_anch = !( (prog->intflags & (PREGf_ANCH_SBOL|PREGf_ANCH_GPOS))
-                     || ( (prog->intflags & PREGf_ANCH_BOL)
-                         && !multiline ) );    /* Check after \n? */
+        /* Check after \n? */
+       ml_anch = (     (prog->intflags & PREGf_ANCH_MBOL)
+                   || ((prog->intflags & PREGf_ANCH_BOL) && multiline));
 
        if (!ml_anch) {
             /* we are only allowed to match at BOS or \G */