regexec.c: Refactor slightly for clarity
authorKarl Williamson <public@khwilliamson.com>
Sun, 7 Oct 2012 20:08:42 +0000 (14:08 -0600)
committerKarl Williamson <public@khwilliamson.com>
Tue, 9 Oct 2012 17:16:06 +0000 (11:16 -0600)
This reverses the sense of an if...else, so that the tiny trivial code
is done after the 'if', and the larger, non-trivial part is done in the
else.  This makes it easier to understand.  It also is clear that the
label and goto are no longer needed, if they ever were.

regexec.c

index 40c7038..0d4c4e4 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -5717,8 +5717,10 @@ NULL
            */
 
            assert(ST.min <= ST.max);
-           if (HAS_TEXT(next) || JUMPABLE(next)) {
-               U8 *s;
+            if (! HAS_TEXT(next) && ! JUMPABLE(next)) {
+                ST.c1 = ST.c2 = CHRTEST_VOID;
+            }
+            else {
                regnode *text_node = next;
 
                if (! HAS_TEXT(text_node)) 
@@ -5729,7 +5731,6 @@ NULL
                else {
                    if ( PL_regkind[OP(text_node)] != EXACT ) {
                        ST.c1 = ST.c2 = CHRTEST_VOID;
-                       goto assume_ok_easy;
                    }
                    else {
                     
@@ -5747,9 +5748,6 @@ NULL
                     }
                }
            }
-           else
-               ST.c1 = ST.c2 = CHRTEST_VOID;
-       assume_ok_easy:
 
            ST.A = scan;
            ST.B = next;