summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2012-06-06 15:40:38 -0600
committerKarl Williamson <public@khwilliamson.com>2012-06-07 09:55:50 -0600
commitdd9267d7ed4287d573abd56d1aadf2152c628baf (patch)
treefcdc1400ff4f0e26868fb9e88c6ad5594b37bcdf /utf8.c
parent2114036ce68685bad99e2d43873afa0ff512b0a6 (diff)
downloadperl-dd9267d7ed4287d573abd56d1aadf2152c628baf.tar.gz
utf8.c: Avoid some extra work
In the case changed, the output is the input, so can just Copy it instead of re-deriving it.
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/utf8.c b/utf8.c
index 53591101a2..5469a8e139 100644
--- a/utf8.c
+++ b/utf8.c
@@ -2419,9 +2419,11 @@ Perl_to_utf8_case(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp,
}
}
- if (!len) /* Neither: just copy. In other words, there was no mapping
- defined, which means that the code point maps to itself */
- len = uvchr_to_utf8(ustrp, uv0) - ustrp;
+ if (!len) { /* There was no mapping defined, which means that the code
+ point maps to itself */
+ len = UTF8SKIP(p);
+ Copy(p, ustrp, len, U8);
+ }
if (lenp)
*lenp = len;