summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2010-12-28 16:13:49 -0700
committerKarl Williamson <public@khwilliamson.com>2011-01-16 19:13:25 -0700
commit63ac0dadb1aafcf0c171d3c1422c1923b611b2fc (patch)
treee6739a7dccd9be2b3b192d6e99042702fc4f9440 /regcomp.c
parent7259d778cc13ce118e31fad7e1b91f23fc1b8e97 (diff)
downloadperl-63ac0dadb1aafcf0c171d3c1422c1923b611b2fc.tar.gz
regex: Use BOUNDU regnodes
This refactors one area in regexec.c to use BOUNDU, NBOUNDU for efficiciency, and easier adding of the future BOUNDA.
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/regcomp.c b/regcomp.c
index cbcabdf4a1..1eded27803 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -7399,22 +7399,40 @@ tryagain:
case 'b':
RExC_seen_zerolen++;
RExC_seen |= REG_SEEN_LOOKBEHIND;
- if (LOC) {
- ret = reg_node(pRExC_state, (U8)(BOUNDL));
- } else {
- ret = reg_node(pRExC_state, (U8)(BOUND));
+ switch (get_regex_charset(RExC_flags)) {
+ case REGEX_LOCALE_CHARSET:
+ op = BOUNDL;
+ break;
+ case REGEX_UNICODE_CHARSET:
+ op = BOUNDU;
+ break;
+ case REGEX_DEPENDS_CHARSET:
+ op = BOUND;
+ break;
+ default:
+ goto bad_charset;
}
+ ret = reg_node(pRExC_state, op);
FLAGS(ret) = get_regex_charset(RExC_flags);
*flagp |= SIMPLE;
goto finish_meta_pat;
case 'B':
RExC_seen_zerolen++;
RExC_seen |= REG_SEEN_LOOKBEHIND;
- if (LOC) {
- ret = reg_node(pRExC_state, (U8)(NBOUNDL));
- } else {
- ret = reg_node(pRExC_state, (U8)(NBOUND));
+ switch (get_regex_charset(RExC_flags)) {
+ case REGEX_LOCALE_CHARSET:
+ op = NBOUNDL;
+ break;
+ case REGEX_UNICODE_CHARSET:
+ op = NBOUNDU;
+ break;
+ case REGEX_DEPENDS_CHARSET:
+ op = NBOUND;
+ break;
+ default:
+ goto bad_charset;
}
+ ret = reg_node(pRExC_state, op);
FLAGS(ret) = get_regex_charset(RExC_flags);
*flagp |= SIMPLE;
goto finish_meta_pat;