From ab60c45aeb1dd179abc80fd3a27963e6518497a7 Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Mon, 17 Feb 2014 19:45:12 +0000 Subject: [PATCH] re_intuit_start(): swap another if/else block Change { if (cond) goto x; A; goto y; } x: into { if (!cond) { A; goto y; } } x: Functionally equivalent, but eliminates one 'goto'. --- regexec.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/regexec.c b/regexec.c index cc459c1..d842153 100644 --- a/regexec.c +++ b/regexec.c @@ -1283,20 +1283,20 @@ Perl_re_intuit_start(pTHX_ 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) - /* already at latest position float substr could match */ - goto hop_and_restart; - /* Recheck anchored substring, but not floating... */ - if (!check) { - rx_origin = NULL; - goto giveup; + 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)) ); + assert(prog->substrs->check_ix); /* other is float */ + 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)) ); - assert(prog->substrs->check_ix); /* other is float */ - goto do_other_substr; - } + } hop_and_restart: rx_origin = HOP3c(rx_origin, 1, strend); -- 2.7.4