diff options
author | Karl Williamson <public@khwilliamson.com> | 2014-02-17 12:49:10 -0700 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2014-02-19 08:32:59 -0700 |
commit | e0e1be5fc663ef0fdda840a92e286b8eece99537 (patch) | |
tree | a1a07cc7daeeea195ec6e0e5459cabff2a5c92b7 /regcomp.h | |
parent | 0ba8faef1d393a5e5eec58121e95c78331a76dda (diff) | |
download | perl-e0e1be5fc663ef0fdda840a92e286b8eece99537.tar.gz |
regcomp.c: Simplify /l Synthetic Start Class construction
The ANYOF_POSIXL flag is needed in general for ANYOF nodes to indicate
if the struct contains an extra U32 element used to hold the list of
POSIX classes (like \w and [:punct:]) whose matches depend on the locale
in effect at the time of runtime pattern matching.
But the SSC always contains this U32, and so doesn't need to use the
flag. Instead, if there aren't any such classes, the U32 will be zero.
Removing keeping track of this flag during the assembly of the SSC
simplifies things. At the completion of this process, this flag is
set if the U32 is non-zero to pass that information on to regexec.c so
that it doesn't have to special case things.
Diffstat (limited to 'regcomp.h')
-rw-r--r-- | regcomp.h | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -538,9 +538,18 @@ struct regnode_ssc { && (((regnode_charclass_posixl*)(p))->classflags)) #define ANYOF_CLASS_TEST_ANY_SET(p) ANYOF_POSIXL_TEST_ANY_SET(p) -#define ANYOF_POSIXL_TEST_ALL_SET(p) \ - ((ANYOF_FLAGS(p) & ANYOF_POSIXL) \ - && ((regnode_charclass_posixl*) (p))->classflags == ((1U << ((ANYOF_POSIXL_MAX) - 1))) - 1) +/* Since an SSC always has this field, we don't have to test for that; nor do + * we want to because the bit isn't set for SSC during its construction */ +#define ANYOF_POSIXL_SSC_TEST_ANY_SET(p) \ + cBOOL(((regnode_ssc*)(p))->classflags) +#define ANYOF_POSIXL_SSC_TEST_ALL_SET(p) /* Are all bits set? */ \ + (((regnode_ssc*) (p))->classflags \ + == ((1U << ((ANYOF_POSIXL_MAX) - 1))) - 1) + +#define ANYOF_POSIXL_TEST_ALL_SET(p) \ + ((ANYOF_FLAGS(p) & ANYOF_POSIXL) \ + && ((regnode_charclass_posixl*) (p))->classflags \ + == ((1U << ((ANYOF_POSIXL_MAX) - 1))) - 1) #define ANYOF_POSIXL_OR(source, dest) STMT_START { (dest)->classflags |= (source)->classflags ; } STMT_END #define ANYOF_CLASS_OR(source, dest) ANYOF_POSIXL_OR((source), (dest)) |