summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2013-02-09 21:23:30 -0700
committerKarl Williamson <public@khwilliamson.com>2013-08-29 09:55:50 -0600
commit55d09dc854b450c4051bea8318009a46a7c083f7 (patch)
tree8236a7ebb103a8d309b420bfa8761d2508cb626e /utf8.c
parentc12874164f0487ef49dc48d5e4263b86b4b87f5d (diff)
downloadperl-55d09dc854b450c4051bea8318009a46a7c083f7.tar.gz
Extract common code to an inline function
This fairly short paradigm is repeated in several places; a later commit will improve it.
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/utf8.c b/utf8.c
index 1bdad1b3d2..b445a2efbc 100644
--- a/utf8.c
+++ b/utf8.c
@@ -1376,13 +1376,8 @@ Perl_bytes_to_utf8(pTHX_ const U8 *s, STRLEN *len)
dst = d;
while (s < send) {
- const UV uv = NATIVE_TO_ASCII(*s++);
- if (UNI_IS_INVARIANT(uv))
- *d++ = (U8)UTF_TO_NATIVE(uv);
- else {
- *d++ = (U8)UTF8_EIGHT_BIT_HI(uv);
- *d++ = (U8)UTF8_EIGHT_BIT_LO(uv);
- }
+ append_utf8_from_native_byte(*s, &d);
+ s++;
}
*d = '\0';
*len = d-dst;