summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2011-10-16 13:36:36 -0600
committerKarl Williamson <public@khwilliamson.com>2011-10-17 21:52:17 -0600
commitbca00c02a54ca312397c6b26baf3012ac5f7b9c5 (patch)
tree9384d2fe7e44b7a3e618e32086662c9304674594 /utf8.c
parent77a6d8568e288ad300ad7f0805946559b4ec28d1 (diff)
downloadperl-bca00c02a54ca312397c6b26baf3012ac5f7b9c5.tar.gz
utf8.c: Don't use swash for to_uni_lower() latin1 calls
The lowercase of latin-1 range code points is known to the perl core, so for those we can short-ciruit converting to utf8 and reading in a swash
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/utf8.c b/utf8.c
index 0c2158429a..9b42c755bb 100644
--- a/utf8.c
+++ b/utf8.c
@@ -1346,8 +1346,24 @@ Perl_to_uni_lower(pTHX_ UV c, U8* p, STRLEN *lenp)
{
PERL_ARGS_ASSERT_TO_UNI_LOWER;
- uvchr_to_utf8(p, c);
- return to_utf8_lower(p, p, lenp);
+ if (c > 255) {
+ uvchr_to_utf8(p, c);
+ return to_utf8_lower(p, p, lenp);
+ }
+
+ /* We have the latin1-range values compiled into the core, so just use
+ * those, converting the result to utf8 */
+ c = toLOWER_LATIN1(c);
+ if (UNI_IS_INVARIANT(c)) {
+ *p = c;
+ *lenp = 1;
+ }
+ else {
+ *p = UTF8_TWO_BYTE_HI(c);
+ *(p+1) = UTF8_TWO_BYTE_LO(c);
+ *lenp = 2;
+ }
+ return c;
}
UV