regcomp.c: Swap two else clauses for clarity.
authorKarl Williamson <public@khwilliamson.com>
Fri, 24 Jan 2014 02:50:12 +0000 (19:50 -0700)
committerKarl Williamson <public@khwilliamson.com>
Tue, 28 Jan 2014 06:03:47 +0000 (23:03 -0700)
This makes one clause mostly positive tests, instead of mostly negative
tests; using positives is easier to understand.

regcomp.c

index 6be379e..97a5490 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -10813,20 +10813,21 @@ S_alloc_maybe_populate_EXACT(pTHX_ RExC_state_t *pRExC_state,
                 uvchr_to_utf8( character, code_point);
                 len = UTF8SKIP(character);
             }
-        }
-        else if (! FOLD
-                 || code_point != LATIN_SMALL_LETTER_SHARP_S
-                 || ASCII_FOLD_RESTRICTED
-                 || ! AT_LEAST_UNI_SEMANTICS)
+        } /* Else pattern isn't UTF8.  We only fold the sharp s, when
+             appropriate */
+        else if (UNLIKELY(code_point == LATIN_SMALL_LETTER_SHARP_S)
+                 && FOLD
+                 && AT_LEAST_UNI_SEMANTICS
+                 && ! ASCII_FOLD_RESTRICTED)
         {
-            *character = (U8) code_point;
-            len = 1;
-        }
-        else {
             *character = 's';
             *(character + 1) = 's';
             len = 2;
         }
+        else {
+            *character = (U8) code_point;
+            len = 1;
+        }
     }
 
     if (SIZE_ONLY) {