summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2014-03-19 16:34:28 +0000
committerDavid Mitchell <davem@iabyn.com>2014-03-19 18:25:55 +0000
commit343c8a296e416def92250d436a4ed6ffb932445f (patch)
tree115d4341a21b65cc59e596e9eba51f975d99e96b /regexec.c
parente0eb31e7431d11b499dac9bfbae6dda175eab0fd (diff)
downloadperl-343c8a296e416def92250d436a4ed6ffb932445f.tar.gz
re_intuit_start(): check for IMPLICIT in abs anch
The block of code that deals with absolute anchors looks like: if (...) { if (.... && !PREGf_IMPLICIT) ...; if (FOO) { assert(!PREGf_IMPLICIT); .... } } where the constraints of FOO imply PREGf_IMPLICIT, as shown by the assertion. Simplify this to: if (... && !PREGf_IMPLICIT) { if (....) ...; if (FOO) { .... } }
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/regexec.c b/regexec.c
index 44fa720ef3..aa9e8266ab 100644
--- a/regexec.c
+++ b/regexec.c
@@ -755,7 +755,7 @@ Perl_re_intuit_start(pTHX_
/* Check after \n? */
ml_anch = (prog->intflags & PREGf_ANCH_MBOL);
- if (!ml_anch) {
+ if (!ml_anch && !(prog->intflags & PREGf_IMPLICIT)) {
/* we are only allowed to match at BOS or \G */
/* trivially reject if there's a BOS anchor and we're not at BOS.
@@ -775,8 +775,7 @@ Perl_re_intuit_start(pTHX_
* that we're anchored.
*/
if ( strpos != strbeg
- && (prog->intflags & (PREGf_ANCH_BOL|PREGf_ANCH_SBOL))
- && !(prog->intflags & PREGf_IMPLICIT)) /* not a real BOL */
+ && (prog->intflags & (PREGf_ANCH_BOL|PREGf_ANCH_SBOL)))
{
DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log,
" Not at start...\n"));
@@ -798,17 +797,7 @@ Perl_re_intuit_start(pTHX_
{
/* Substring at constant offset from beg-of-str... */
SSize_t slen = SvCUR(check);
- char *s;
-
- /* we only get here if there's a fixed substring (min ==
- * max). But PREGf_IMPLICIT only gets set if the regex
- * begins with /.*.../, and in that case there can't be
- * a fixed substring. So assert this truth. If anyone
- * changes this assumption (e.g. with lookahead/behind),
- * complain and let them fix it */
- assert(!(prog->intflags & PREGf_IMPLICIT));
-
- s = HOP3c(strpos, prog->check_offset_min, strend);
+ char *s = HOP3c(strpos, prog->check_offset_min, strend);
DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log,
" Looking for check substr at fixed offset %"IVdf"...\n",