regcomp.c: Reorder tests to avoid throwing away work.
authorKarl Williamson <public@khwilliamson.com>
Mon, 6 May 2013 00:40:08 +0000 (18:40 -0600)
committerKarl Williamson <public@khwilliamson.com>
Tue, 18 Jun 2013 05:25:21 +0000 (23:25 -0600)
Prior to this patch, we did work based on a test that could be thrown
away as a result of the next test.  This reorders so that doesn't happen

regcomp.c

index 0033805..e660e5e 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -11343,12 +11343,6 @@ tryagain:
        loopdone:   /* Jumped to when encounters something that shouldn't be in
                       the node */
 
-            /* If 'maybe_exact' is still set here, means there are no
-             * code points in the node that participate in folds */
-            if (FOLD && maybe_exact) {
-                OP(ret) = EXACT;
-            }
-
             /* I (khw) don't know if you can get here with zero length, but the
              * old code handled this situation by creating a zero-length EXACT
              * node.  Might as well be NOTHING instead */
@@ -11356,6 +11350,12 @@ tryagain:
                 OP(ret) = NOTHING;
             }
             else{
+
+                /* If 'maybe_exact' is still set here, means there are no
+                 * code points in the node that participate in folds */
+                if (FOLD && maybe_exact) {
+                    OP(ret) = EXACT;
+                }
                 alloc_maybe_populate_EXACT(pRExC_state, ret, flagp, len, ender);
             }