regcomp.c: Avoid unnecessary runtime fold checking
authorKarl Williamson <public@khwilliamson.com>
Fri, 6 Jan 2012 20:27:17 +0000 (13:27 -0700)
committerKarl Williamson <public@khwilliamson.com>
Fri, 13 Jan 2012 16:58:39 +0000 (09:58 -0700)
Since 5.14, the single-char folds have been calculated at compile time,
either by doing it there, or for properties, setting the swash name to
include a foleded or non-folded version of the property.  Thus this
patch could have been done much earlier.

Now, most of the properties are actually computed at compile time by
previous patches, but that isn't relevant to this one.

Thus there really doesn't need to be runtime folding for things that
aren't in the bitmap, except for those things under /d that match only
if the string is in UTF8.

regcomp.c

index 1b738b6..b71942f 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -10989,8 +10989,15 @@ parseit:
 
     /* Folding in the bitmap is taken care of above, but not for locale (for
      * which we have to wait to see what folding is in effect at runtime), and
-     * for things not in the bitmap.  Set run-time fold flag for these */
-    if (FOLD && (LOC || nonbitmap || unicode_alternate)) {
+     * for some things not in the bitmap (only the upper latin folds in this
+     * case, as all other single-char folding has been set above).  Set
+     * run-time fold flag for these */
+    if (FOLD && (LOC
+               || (DEPENDS_SEMANTICS
+                   && nonbitmap
+                   && ! (ANYOF_FLAGS(ret) & ANYOF_NONBITMAP_NON_UTF8))
+               || unicode_alternate))
+    {
        ANYOF_FLAGS(ret) |= ANYOF_LOC_NONBITMAP_FOLD;
     }