diff options
author | Karl Williamson <public@khwilliamson.com> | 2013-02-09 21:23:30 -0700 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2013-08-29 09:55:50 -0600 |
commit | 55d09dc854b450c4051bea8318009a46a7c083f7 (patch) | |
tree | 8236a7ebb103a8d309b420bfa8761d2508cb626e /pp_pack.c | |
parent | c12874164f0487ef49dc48d5e4263b86b4b87f5d (diff) | |
download | perl-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 'pp_pack.c')
-rw-r--r-- | pp_pack.c | 16 |
1 files changed, 2 insertions, 14 deletions
@@ -357,24 +357,12 @@ S_bytes_to_uni(const U8 *start, STRLEN len, char *dest, const bool needs_swap) { if (UNLIKELY(needs_swap)) { const U8 *p = start + len; while (p-- > start) { - const UV uv = NATIVE_TO_ASCII(*p); - if (UNI_IS_INVARIANT(uv)) - *dest++ = (char)(U8)UTF_TO_NATIVE(uv); - else { - *dest++ = (char)(U8)UTF8_EIGHT_BIT_HI(uv); - *dest++ = (char)(U8)UTF8_EIGHT_BIT_LO(uv); - } + append_utf8_from_native_byte(*p, (U8 **) & dest); } } else { const U8 * const end = start + len; while (start < end) { - const UV uv = NATIVE_TO_ASCII(*start); - if (UNI_IS_INVARIANT(uv)) - *dest++ = (char)(U8)UTF_TO_NATIVE(uv); - else { - *dest++ = (char)(U8)UTF8_EIGHT_BIT_HI(uv); - *dest++ = (char)(U8)UTF8_EIGHT_BIT_LO(uv); - } + append_utf8_from_native_byte(*start, (U8 **) & dest); start++; } } |