From 274cd3128fde00ccd4e3559d72655d1677eaa5c2 Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Fri, 27 Dec 2013 23:23:12 +0000 Subject: [PATCH] re_intuit_start(): simplify ml_anch evaluation 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 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/regexec.c b/regexec.c index 67b70c1..0d43d6b 100644 --- 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 */ -- 2.7.4