These areas of code included a temporary that is unnecessary.
/* Takes an input 'byte' (Latin1 or EBCDIC) and appends it to the UTF-8
* encoded string at '*dest', updating '*dest' to include it */
- const U8 uv = NATIVE_TO_LATIN1(byte);
-
PERL_ARGS_ASSERT_APPEND_UTF8_FROM_NATIVE_BYTE;
- if (UNI_IS_INVARIANT(uv))
- *(*dest)++ = UNI_TO_NATIVE(uv);
+ if (NATIVE_IS_INVARIANT(byte))
+ *(*dest)++ = byte;
else {
- *(*dest)++ = UTF8_EIGHT_BIT_HI(uv);
- *(*dest)++ = UTF8_EIGHT_BIT_LO(uv);
+ *(*dest)++ = UTF8_EIGHT_BIT_HI(byte);
+ *(*dest)++ = UTF8_EIGHT_BIT_LO(byte);
}
}
Newx(dst, *plen_p * 2 + 1, U8);
while (s < *plen_p) {
- const UV uv = NATIVE_TO_ASCII(src[s]);
- if (UNI_IS_INVARIANT(uv))
- dst[d] = (U8)UTF_TO_NATIVE(uv);
+ if (NATIVE_IS_INVARIANT(src[s]))
+ dst[d] = src[s];
else {
- dst[d++] = (U8)UTF8_EIGHT_BIT_HI(uv);
- dst[d] = (U8)UTF8_EIGHT_BIT_LO(uv);
+ dst[d++] = UTF8_EIGHT_BIT_HI(src[s]);
+ dst[d] = UTF8_EIGHT_BIT_LO(src[s]);
}
if (n < num_code_blocks) {
if (!do_end && pRExC_state->code_blocks[n].start == s) {
e--;
while (e >= t) {
- const U8 ch = NATIVE8_TO_UNI(*e--);
- if (UNI_IS_INVARIANT(ch)) {
- *d-- = UNI_TO_NATIVE(ch);
+ if (NATIVE_IS_INVARIANT(*e)) {
+ *d-- = *e;
} else {
- *d-- = (U8)UTF8_EIGHT_BIT_LO(ch);
- *d-- = (U8)UTF8_EIGHT_BIT_HI(ch);
+ *d-- = UTF8_EIGHT_BIT_LO(*e);
+ *d-- = UTF8_EIGHT_BIT_HI(*e);
}
+ e--;
}
}