summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2014-02-17 20:46:15 +0000
committerDavid Mitchell <davem@iabyn.com>2014-03-16 18:03:49 +0000
commit97136c8a5affa3c46e244cc603af319eafb3938b (patch)
tree44455cb698316ac9d16b3b48c398d0ac5442202e /regexec.c
parent3369914b87d2d563caa427611eb6e81820d8796a (diff)
downloadperl-97136c8a5affa3c46e244cc603af319eafb3938b.tar.gz
re_intuit_start(): de-duplicate condition
Change if (have_anchored && check_ix == 1) { B; } if (!have_anchored) { A; } C; To: if (have_anchored) { if (check_ix == 1) { B; } } else { A; } C; This change should be functionally equivalent, but eliminates calculating the have_anchored condition twice.
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/regexec.c b/regexec.c
index 13b5ce2880..368b52b484 100644
--- a/regexec.c
+++ b/regexec.c
@@ -1280,25 +1280,25 @@ Perl_re_intuit_start(pTHX_
(IV)start_shift, (IV)(check_at - strbeg), (IV)(endpos - strbeg), (IV)(checked_upto- strbeg)));
/* Contradict one of substrings */
- if ((prog->anchored_substr || prog->anchored_utf8)
- && prog->substrs->check_ix == 1) { /* check is float */
- /* Have both, check_string is floating */
- assert(rx_origin + start_shift <= check_at);
- if (rx_origin + start_shift != check_at) {
- /* not at latest position float substr could match:
- * Recheck anchored substring, but not floating... */
- if (!check) {
- rx_origin = NULL;
- goto giveup;
+ if (prog->anchored_substr || prog->anchored_utf8) {
+ if (prog->substrs->check_ix == 1) { /* check is float */
+ /* Have both, check_string is floating */
+ assert(rx_origin + start_shift <= check_at);
+ if (rx_origin + start_shift != check_at) {
+ /* not at latest position float substr could match:
+ * Recheck anchored substring, but not floating... */
+ if (!check) {
+ rx_origin = NULL;
+ goto giveup;
+ }
+ DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log,
+ " Looking for anchored substr starting at offset %ld...\n",
+ (long)(other_last - strpos)) );
+ goto do_other_substr;
}
- DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log,
- " Looking for anchored substr starting at offset %ld...\n",
- (long)(other_last - strpos)) );
- goto do_other_substr;
}
}
-
- if (!(prog->anchored_substr || prog->anchored_utf8)) {
+ else {
/* float-only */
/* Another way we could have checked stclass at the