summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2017-11-01 18:45:36 +0000
committerDavid Mitchell <davem@iabyn.com>2017-11-02 08:58:27 +0000
commit576915daebd987c8149486c51d8423a1dd471ded (patch)
tree2083340de72bc35d11c3287984a12627e98d6b95 /pp_hot.c
parentb3baa1fe7b5f973daeb2a46cb3afae8624d0f0ab (diff)
downloadperl-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.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/pp_hot.c b/pp_hot.c
index fff91396ff..2ce77b38ef 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -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