re_intuit_start(): factor out some common code
authorDavid Mitchell <davem@iabyn.com>
Thu, 26 Dec 2013 20:54:08 +0000 (20:54 +0000)
committerDavid Mitchell <davem@iabyn.com>
Fri, 7 Feb 2014 22:39:35 +0000 (22:39 +0000)
3 assignments are done at the end of both branches of an if/else;
factor them out after the end.

regexec.c

index 08f1066..7c56623 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -744,21 +744,15 @@ Perl_re_intuit_start(pTHX_
        }
 
        /* Match is anchored, but substr is not anchored wrt beg-of-str. */
-       s = strpos;
-       start_shift = prog->check_offset_min; /* okay to underestimate on CC */
-       end_shift = prog->check_end_shift;
-       
        if (!ml_anch && prog->check_offset_max != SSize_t_MAX)
             max_shift = prog->check_offset_max;
     }
     else {                             /* Can match at random position */
        ml_anch = 0;
-       s = strpos;
-       start_shift = prog->check_offset_min;  /* okay to underestimate on CC */
-       end_shift = prog->check_end_shift;
-       
-       /* end shift should be non negative here */
     }
+    s = strpos;
+    start_shift = prog->check_offset_min;  /* okay to underestimate on CC */
+    end_shift = prog->check_end_shift;
 
 #ifdef DEBUGGING       /* 7/99: reports of failure (with the older version) */
     if (end_shift < 0)