summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-12-31 03:42:15 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-12-31 03:42:15 +0000
commit80aecb99acb05e810c6136645b97c6bc9f385ca3 (patch)
tree8b3501a90da87c060f36d545f189b76abbbff920 /regcomp.c
parent001dd6eafe700cce33b7751595203247724dc4ac (diff)
downloadperl-80aecb99acb05e810c6136645b97c6bc9f385ca3.tar.gz
Delay folding until necessary; start of handling
folding into several characters. p4raw-id: //depot/perl@13969
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c48
1 files changed, 37 insertions, 11 deletions
diff --git a/regcomp.c b/regcomp.c
index b061991342..cac14bf8e6 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -2986,7 +2986,8 @@ tryagain:
char *oldp, *s;
STRLEN numlen;
STRLEN ulen;
- U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
+ STRLEN foldlen;
+ U8 tmpbuf[UTF8_MAXLEN_UCLC+1], *foldbuf;
parse_start = RExC_parse - 1;
@@ -3130,17 +3131,28 @@ tryagain:
}
if (RExC_flags16 & PMf_EXTENDED)
p = regwhite(p, RExC_end);
- if (UTF && FOLD) {
- toFOLD_uni(ender, tmpbuf, &ulen);
- ender = utf8_to_uvchr(tmpbuf, 0);
- }
+ if (UTF && FOLD)
+ toFOLD_uni(ender, tmpbuf, &foldlen);
if (ISMULT2(p)) { /* Back off on ?+*. */
if (len)
p = oldp;
else if (!UNI_IS_INVARIANT(NATIVE_TO_UNI(ender)) && UTF) {
- reguni(pRExC_state, ender, s, &numlen);
- s += numlen;
- len += numlen;
+ if (FOLD) {
+ for (foldbuf = tmpbuf;
+ foldlen;
+ foldlen -= numlen) {
+ ender = utf8_to_uvchr(foldbuf, &numlen);
+ reguni(pRExC_state, ender, s, &numlen);
+ s += numlen;
+ len += numlen;
+ foldbuf += numlen;
+ }
+ }
+ else {
+ reguni(pRExC_state, ender, s, &numlen);
+ s += numlen;
+ len += numlen;
+ }
}
else {
len++;
@@ -3149,9 +3161,23 @@ tryagain:
break;
}
if (!UNI_IS_INVARIANT(NATIVE_TO_UNI(ender)) && UTF) {
- reguni(pRExC_state, ender, s, &numlen);
- s += numlen;
- len += numlen - 1;
+ if (FOLD) {
+ for (foldbuf = tmpbuf;
+ foldlen;
+ foldlen -= numlen) {
+ ender = utf8_to_uvchr(foldbuf, &numlen);
+ reguni(pRExC_state, ender, s, &numlen);
+ s += numlen;
+ len += numlen;
+ foldbuf += numlen;
+ }
+ }
+ else {
+ reguni(pRExC_state, ender, s, &numlen);
+ s += numlen;
+ len += numlen;
+ }
+ len--;
}
else
REGC(ender, s++);