regcomp.h: Make some #defines sequential
authorKarl Williamson <public@khwilliamson.com>
Thu, 16 Aug 2012 03:32:30 +0000 (21:32 -0600)
committerKarl Williamson <public@khwilliamson.com>
Tue, 20 Nov 2012 00:13:00 +0000 (17:13 -0700)
ANYOF_MAX is used as the upper boundary in loops.  If we keep it larger
than necessary, the loop does extraneous iterations.

The #defines that come after ANYOF_MAX are moved down to start with it.
This is useful in a later commit that will create an entry in
l1_char_class_tab.h for vertical white space determination.

regcomp.h

index 1f6f765..e9c9c4c 100644 (file)
--- a/regcomp.h
+++ b/regcomp.h
@@ -415,21 +415,23 @@ struct regnode_charclass_class {
 #define ANYOF_BLANK    ((_CC_BLANK) * 2)     /* GNU extension: space and tab: non-vertical space */
 #define ANYOF_NBLANK   ((ANYOF_BLANK) + 1)
 
-#define ANYOF_MAX      32
-#if (ANYOF_MAX <= _HIGHEST_REGCOMP_DOT_H_SYNC * 2 + 1)
+#define ANYOF_MAX      ((ANYOF_NBLANK) + 1) /* So upper loop limit is written:
+                                               '< ANYOF_MAX' */
+#if (ANYOF_MAX > 32)                        /* Must fit in 32-bit word */
 #   error Problem with handy.h _CC_foo #defines
 #endif
 
-/* pseudo classes, not stored in the class bitmap, but used as flags
+/* pseudo classes below this, not stored in the class bitmap, but used as flags
    during compilation of char classes */
 
-#define ANYOF_VERTWS   (ANYOF_MAX+1)
-#define ANYOF_NVERTWS  (ANYOF_MAX+2)
-#define ANYOF_HORIZWS  (ANYOF_MAX+3)
-#define ANYOF_NHORIZWS (ANYOF_MAX+4)
+#define ANYOF_VERTWS    ((ANYOF_MAX)+0)
+#define ANYOF_NVERTWS   ((ANYOF_MAX)+1)
 
-#define ANYOF_UNIPROP   (ANYOF_MAX+5)  /* Used to indicate a Unicode property:
-                                          \p{} or \P{} */
+#define ANYOF_HORIZWS  ((ANYOF_MAX)+2)
+#define ANYOF_NHORIZWS ((ANYOF_MAX)+3)
+
+#define ANYOF_UNIPROP   ((ANYOF_MAX)+4)  /* Used to indicate a Unicode
+                                            property: \p{} or \P{} */
 
 /* Backward source code compatibility. */