regcomp.c: Optimize /[[:blank:]]/u into \h
authorKarl Williamson <public@khwilliamson.com>
Fri, 20 Jul 2012 17:39:09 +0000 (11:39 -0600)
committerKarl Williamson <public@khwilliamson.com>
Wed, 25 Jul 2012 03:13:49 +0000 (21:13 -0600)
These two are equivalent.

regcomp.c

index 9c79400..fd2e735 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -11939,6 +11939,7 @@ parseit:
                     invert = ! invert;
                     /* FALLTHROUGH */
                 case ANYOF_HORIZWS:
+                  is_horizws:
                     op = (invert) ? NHORIZWS : HORIZWS;
                     break;
 
@@ -11952,6 +11953,14 @@ parseit:
                 case ANYOF_MAX:
                     break;
 
+                case ANYOF_NBLANK:
+                    invert = ! invert;
+                    /* FALLTHROUGH */
+                case ANYOF_BLANK:
+                    if (AT_LEAST_UNI_SEMANTICS && ! AT_LEAST_ASCII_RESTRICTED) {
+                        goto is_horizws;
+                    }
+                    /* FALLTHROUGH */
                 default:
                     /* A generic posix class.  All the /a ones can be handled
                      * by the POSIXA opcode.  And all are closed under folding