re_intuit_start(): swap another if/else block
authorDavid Mitchell <davem@iabyn.com>
Mon, 17 Feb 2014 19:45:12 +0000 (19:45 +0000)
committerDavid Mitchell <davem@iabyn.com>
Sun, 16 Mar 2014 18:03:49 +0000 (18:03 +0000)
Change

    {
        if (cond)
            goto x;
        A;
        goto y;
    }
    x:

into

    {
        if (!cond) {
            A;
            goto y;
        }
    }
    x:

Functionally equivalent, but eliminates one 'goto'.

regexec.c

index cc459c1..d842153 100644 (file)
--- 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);