summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2011-03-19 18:37:53 -0600
committerKarl Williamson <public@khwilliamson.com>2011-03-19 19:01:37 -0600
commit9d7a1e6315426819da0d6af6dc79fde72e9c8c08 (patch)
tree455239de8de6869c0652b08e17c915afcf617904
parentd94b1d13d0aa079f8a6d2ee1aac4ed342a28901f (diff)
downloadperl-9d7a1e6315426819da0d6af6dc79fde72e9c8c08.tar.gz
regcomp.c: /l uses the \w, etc. classes
For non-locale, \d, etc are compiled in with their actual code points they match, so the class portion of the synthetic start class node is irrelevant, and should initialized to zero to avoid confusion. But for locale it is highly relevant, and should be initialized to all ones, to indicate matching anything.
-rw-r--r--regcomp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/regcomp.c b/regcomp.c
index b247ee2c07..b48fb579b6 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -727,7 +727,6 @@ S_cl_anything(const RExC_state_t *pRExC_state, struct regnode_charclass_class *c
PERL_ARGS_ASSERT_CL_ANYTHING;
ANYOF_BITMAP_SETALL(cl);
- ANYOF_CLASS_ZERO(cl); /* all bits set, so class is irrelevant */
cl->flags = ANYOF_CLASS|ANYOF_EOS|ANYOF_UNICODE_ALL
|ANYOF_LOC_NONBITMAP_FOLD|ANYOF_NON_UTF8_LATIN1_ALL;
@@ -739,8 +738,12 @@ S_cl_anything(const RExC_state_t *pRExC_state, struct regnode_charclass_class *c
* parts of it may not work properly, it is safest to avoid locale unless
* necessary. */
if (RExC_contains_locale) {
+ ANYOF_CLASS_SETALL(cl); /* /l uses class */
cl->flags |= ANYOF_LOCALE;
}
+ else {
+ ANYOF_CLASS_ZERO(cl); /* Only /l uses class now */
+ }
}
/* Can match anything (initialization) */