summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2004-03-03 11:37:21 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-03-03 21:55:03 +0000
commitb08cf34e02b6d68e83a46f7566341e6914ff1a2e (patch)
tree586f271f43497ec399228597c833d9a97c2bd06e /utf8.c
parente219e2fb468c95e644354a070b0529da6fc4a353 (diff)
downloadperl-b08cf34e02b6d68e83a46f7566341e6914ff1a2e.tar.gz
Speed up the unicode case mappings (for /i, lc, uc, etc).
Subject: [PATCH] [perl #24826] Message-Id: <9B5CBF96-6CE5-11D8-83B0-00039362CB92@iki.fi> p4raw-id: //depot/perl@22427
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/utf8.c b/utf8.c
index 6a665eb110..6b2527cb03 100644
--- a/utf8.c
+++ b/utf8.c
@@ -1401,21 +1401,19 @@ Perl_to_utf8_case(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp, SV **swashp, char *norma
if (!*swashp) /* load on-demand */
*swashp = swash_init("utf8", normal, &PL_sv_undef, 4, 0);
- if (special) {
+ /* The 0xDF is the only special casing Unicode code point below 0x100. */
+ if (special && (uv1 == 0xDF || uv1 > 0xFF)) {
/* It might be "special" (sometimes, but not always,
* a multicharacter mapping) */
HV *hv;
- SV *keysv;
- HE *he;
- SV *val;
-
- if ((hv = get_hv(special, FALSE)) &&
- (keysv = sv_2mortal(Perl_newSVpvf(aTHX_ "%04"UVXf, uv1))) &&
- (he = hv_fetch_ent(hv, keysv, FALSE, 0)) &&
- (val = HeVAL(he))) {
- char *s;
+ SV **svp;
+
+ if ((hv = get_hv(special, FALSE)) &&
+ (svp = hv_fetch(hv, (const char*)tmpbuf, UNISKIP(uv1), FALSE)) &&
+ (*svp)) {
+ char *s;
- s = SvPV(val, len);
+ s = SvPV(*svp, len);
if (len == 1)
len = uvuni_to_utf8(ustrp, NATIVE_TO_UNI(*(U8*)s)) - ustrp;
else {
@@ -1426,7 +1424,7 @@ Perl_to_utf8_case(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp, SV **swashp, char *norma
U8 *t = (U8*)s, *tend = t + len, *d;
d = tmpbuf;
- if (SvUTF8(val)) {
+ if (SvUTF8(*svp)) {
STRLEN tlen = 0;
while (t < tend) {