summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2000-12-09 12:30:43 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2000-12-09 12:30:43 +0000
commit553151e7a76c75a9f0ccbf6e0802e72fde2ec8f2 (patch)
tree8edfed529ab585fc3fffcdea329f73a8f70dc568 /pp_hot.c
parent9f2fcde2fd69814c4c7eeae7dbeadfe25b591bc0 (diff)
parent185419472dd17e55d44dadf1694c95abd0142e43 (diff)
downloadperl-553151e7a76c75a9f0ccbf6e0802e72fde2ec8f2.tar.gz
Integrate mainline.
p4raw-id: //depot/perlio@8048
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 830d56ed03..4020f200a2 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -142,19 +142,19 @@ PP(pp_concat)
dPOPTOPssrl;
STRLEN len;
U8 *s;
- bool left_utf;
- bool right_utf;
+ bool left_utf8;
+ bool right_utf8;
if (TARG == right && SvGMAGICAL(right))
mg_get(right);
if (SvGMAGICAL(left))
mg_get(left);
- left_utf = DO_UTF8(left);
- right_utf = DO_UTF8(right);
+ left_utf8 = DO_UTF8(left);
+ right_utf8 = DO_UTF8(right);
- if (left_utf != right_utf) {
- if (TARG == right && !right_utf) {
+ if (left_utf8 != right_utf8) {
+ if (TARG == right && !right_utf8) {
sv_utf8_upgrade(TARG); /* Now straight binary copy */
SvUTF8_on(TARG);
}
@@ -163,7 +163,7 @@ PP(pp_concat)
U8 *l, *c, *olds = NULL;
STRLEN targlen;
s = (U8*)SvPV(right,len);
- right_utf |= DO_UTF8(right);
+ right_utf8 |= DO_UTF8(right);
if (TARG == right) {
/* Take a copy since we're about to overwrite TARG */
olds = s = (U8*)savepvn((char*)s, len);
@@ -175,28 +175,28 @@ PP(pp_concat)
sv_setpv(left, ""); /* Suppress warning. */
}
l = (U8*)SvPV(left, targlen);
- left_utf |= DO_UTF8(left);
+ left_utf8 |= DO_UTF8(left);
if (TARG != left)
sv_setpvn(TARG, (char*)l, targlen);
- if (!left_utf)
+ if (!left_utf8)
sv_utf8_upgrade(TARG);
/* Extend TARG to length of right (s) */
targlen = SvCUR(TARG) + len;
- if (!right_utf) {
+ if (!right_utf8) {
/* plus one for each hi-byte char if we have to upgrade */
for (c = s; c < s + len; c++) {
- if (*c & 0x80)
+ if (UTF8_IS_CONTINUED(*c))
targlen++;
}
}
SvGROW(TARG, targlen+1);
/* And now copy, maybe upgrading right to UTF8 on the fly */
- for (c = (U8*)SvEND(TARG); len--; s++) {
- if (*s & 0x80 && !right_utf)
- c = uv_to_utf8(c, *s);
- else
- *c++ = *s;
- }
+ if (right_utf8)
+ Copy(s, SvEND(TARG), len, U8);
+ else {
+ for (c = (U8*)SvEND(TARG); len--; s++)
+ c = uv_to_utf8(c, *s);
+ }
SvCUR_set(TARG, targlen);
*SvEND(TARG) = '\0';
SvUTF8_on(TARG);
@@ -235,7 +235,7 @@ PP(pp_concat)
}
else
sv_setpvn(TARG, (char *)s, len); /* suppress warning */
- if (left_utf)
+ if (left_utf8)
SvUTF8_on(TARG);
SETTARG;
RETURN;