From: David Mitchell Date: Fri, 27 Dec 2013 22:06:36 +0000 (+0000) Subject: re_intuit_start(): refactor an if/else block X-Git-Tag: upstream/5.20.0~464^2~61 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=57fcbfa7eef9b70825a20226d93f531a65f195c2;p=platform%2Fupstream%2Fperl.git re_intuit_start(): refactor an if/else block change if (X) { do nothing } else if (Y) { Z } to if (!X && Y) { Z } --- diff --git a/regexec.c b/regexec.c index 8444816..9f0e2c6 100644 --- a/regexec.c +++ b/regexec.c @@ -685,15 +685,14 @@ Perl_re_intuit_start(pTHX_ if (!ml_anch) { /* we are only allowed to match at BOS or \G */ - if (prog->intflags & PREGf_ANCH_GPOS) { - /* in this case, we hope(!) that the caller has already - * set strpos to pos()-gofs, and will already have checked - * that this anchor position is legal - */ - ; - } - else if (!(prog->intflags & PREGf_IMPLICIT) /* not a real BOL */ - && (strpos != strbeg)) + /* trivially reject if there's a BOS anchor and we're not at BOS. + * In the case of \G, we hope(!) that the caller has already + * set strpos to pos()-gofs, and will already have checked + * that this anchor position is legal. So we can skip it here. + */ + if ( !(prog->intflags & PREGf_ANCH_GPOS) + && !(prog->intflags & PREGf_IMPLICIT) /* not a real BOL */ + && (strpos != strbeg)) { DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "Not at start...\n"));