summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-03-27 14:45:05 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-03-27 14:45:05 +0000
commitd2212429110ea5c7ffe992aa2cb18bde7ce6e83d (patch)
tree1528bc102f275f3760c3b49f30169099c486ac45 /regexec.c
parent2e507a43b57896c8a9523e87603504586eeb023f (diff)
downloadperl-d2212429110ea5c7ffe992aa2cb18bde7ce6e83d.tar.gz
Possible fix for "Orks, Dragons, and Elves":
should now build under UTF-8 locales (is building under Solaris en_US.UTF-8 right now). p4raw-id: //depot/perl@15549
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/regexec.c b/regexec.c
index 5a6d72db8c..5dbe166af7 100644
--- a/regexec.c
+++ b/regexec.c
@@ -1131,8 +1131,9 @@ S_find_byclass(pTHX_ regexp * prog, regnode *c, char *s, char *strend, char *sta
else {
U8 *r = reghop3((U8*)s, -1, (U8*)startpos);
- if (s > (char*)r)
- tmp = (I32)utf8n_to_uvchr(r, s - (char*)r, 0, 0);
+ tmp = s > (char*)r ?
+ utf8n_to_uvchr(r, s - (char*)r, 0, 0) :
+ utf8n_to_uvchr(s, UTF8SKIP(s), 0, 0);
}
tmp = ((OP(c) == BOUND ?
isALNUM_uni(tmp) : isALNUM_LC_uvchr(UNI_TO_NATIVE(tmp))) != 0);
@@ -1175,8 +1176,9 @@ S_find_byclass(pTHX_ regexp * prog, regnode *c, char *s, char *strend, char *sta
else {
U8 *r = reghop3((U8*)s, -1, (U8*)startpos);
- if (s > (char*)r)
- tmp = (I32)utf8n_to_uvchr(r, s - (char*)r, 0, 0);
+ tmp = s > (char*)r ?
+ utf8n_to_uvchr(r, s - (char*)r, 0, 0) :
+ utf8n_to_uvchr(s, UTF8SKIP(s), 0, 0);
}
tmp = ((OP(c) == NBOUND ?
isALNUM_uni(tmp) : isALNUM_LC_uvchr(UNI_TO_NATIVE(tmp))) != 0);
@@ -2563,9 +2565,11 @@ S_regmatch(pTHX_ regnode *prog)
if (locinput == PL_bostr)
ln = '\n';
else {
- U8 *r = reghop((U8*)locinput, -1);
+ U8 *r = reghop3((U8*)locinput, -1, (U8*)PL_reg_starttry);
- ln = utf8n_to_uvchr(r, s - (char*)r, 0, 0);
+ ln = locinput > (char*)r ?
+ utf8n_to_uvchr(r, locinput - (char*)r, 0, 0) :
+ utf8n_to_uvchr(locinput, UTF8SKIP(locinput), 0, 0);
}
if (OP(scan) == BOUND || OP(scan) == NBOUND) {
ln = isALNUM_uni(ln);