diff options
author | David Mitchell <davem@iabyn.com> | 2017-11-01 18:45:36 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2017-11-02 08:58:27 +0000 |
commit | 576915daebd987c8149486c51d8423a1dd471ded (patch) | |
tree | 2083340de72bc35d11c3287984a12627e98d6b95 /pp_hot.c | |
parent | b3baa1fe7b5f973daeb2a46cb3afae8624d0f0ab (diff) | |
download | perl-576915daebd987c8149486c51d8423a1dd471ded.tar.gz |
multiconcat: use append_utf8_from_native_byte()
This small inline function does what my code was doing manually in a
couple of places. Should be no functional difference, just makes the code
tidier.
Suggested by Karl.
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -969,16 +969,11 @@ PP(pp_multiconcat) len = -len; if (UNLIKELY(p)) { /* copy plain-but-variant pv to a utf8 targ */ + char * end_pv = dsv_pv + len; assert(dst_utf8); - while (len--) { + while (dsv_pv < end_pv) { U8 c = (U8) *p++; - if (UTF8_IS_INVARIANT(c)) - *dsv_pv++ = c; - else { - *dsv_pv++ = UTF8_EIGHT_BIT_HI(c); - *dsv_pv++ = UTF8_EIGHT_BIT_LO(c); - len--; - } + append_utf8_from_native_byte(c, (U8**)&dsv_pv); } } else |