re_intuit_start(): simplify check-only origin test
authorDavid Mitchell <davem@iabyn.com>
Sun, 2 Feb 2014 19:29:35 +0000 (19:29 +0000)
committerDavid Mitchell <davem@iabyn.com>
Sat, 8 Feb 2014 13:50:10 +0000 (13:50 +0000)
In the case where there's no "other" substring, we check whether
the regex origin would be at the start of string.However, a few commits
ago we introduced the rx_origin var, and we can use this value now
simplify the test, which was effectively re-calculating rx_origin each
time.

regexec.c

index 9ea1773..9310167 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -1092,13 +1092,7 @@ Perl_re_intuit_start(pTHX_
         )
     );
 
-    /* signed-corrected rx_origin > strpos */
-    if (s - strpos > prog->check_offset_max
-        && (!utf8_target
-           || ((rx_origin = (char*)reghopmaybe3((U8*)s,
-                                    -prog->check_offset_max, (U8*) strpos))
-                && rx_origin > strpos)))
-    {
+    if (rx_origin != strpos) {
        /* Fixed substring is found far enough so that the match
           cannot start at strpos. */
       try_at_offset: