From 87cad4c09451b76f5dcf8b493f84dc07cc915ce6 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Wed, 15 Aug 2012 21:32:30 -0600 Subject: [PATCH] regcomp.h: Make some #defines sequential 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 | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/regcomp.h b/regcomp.h index 1f6f765..e9c9c4c 100644 --- 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. */ -- 1.8.3.1