From 8f4bf5fc7bce4abc2119b7d08c9265b7e17285e1 Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Thu, 6 Feb 2014 16:36:52 +0000 Subject: [PATCH] re_intuit_start(): unconditionally init other_last Initialise other_last to strpos at the top if the function, rather than initialising it to NULL then later setting it to strpos if NULL. Makes the code simpler. Although strpos can currently change doing execution, the conditional assignment always happens before strpos has had a chance to change. --- regexec.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/regexec.c b/regexec.c index 37253a5..54ebd36 100644 --- a/regexec.c +++ b/regexec.c @@ -644,7 +644,7 @@ Perl_re_intuit_start(pTHX_ const bool utf8_target = (sv && SvUTF8(sv)) ? 1 : 0; /* if no sv we have to assume bytes */ U8 other_ix = 1 - prog->substrs->check_ix; bool ml_anch = 0; - char *other_last = NULL; /* latest pos 'other' substr already checked to */ + char *other_last = strpos;/* latest pos 'other' substr already checked to */ char *check_at = NULL; /* check substr found at this pos */ char *checked_upto = NULL; /* how far into the string we have already checked using find_byclass*/ const I32 multiline = prog->extflags & RXf_PMf_MULTILINE; @@ -909,9 +909,6 @@ Perl_re_intuit_start(pTHX_ : prog->substrs->data[other_ix].substr) { /* Take into account the "other" substring. */ - if (!other_last) - other_last = strpos; - do_other_substr: { char *last, *last1; -- 2.7.4