#endif
#endif
-#define HALF_UPGRADE(start,end) \
+#define HALF_UTF8_UPGRADE(start,end) \
STMT_START { \
U8* NeWsTr; \
STRLEN LeN = (end) - (start); \
NeWsTr = bytes_to_utf8(start, &LeN); \
- Copy(NeWsTr,start,LeN,U8*); \
- end = (start) + LeN; \
+ Safefree(start); \
+ (start) = NeWsTr; \
+ (end) = (start) + LeN; \
} STMT_END
-
STATIC I32
S_do_trans_simple(pTHX_ SV *sv)
{
s += UTF8SKIP(s);
matches++;
if ((uv & 0x80) && !isutf++)
- HALF_UPGRADE(dstart,d);
+ HALF_UTF8_UPGRADE(dstart,d);
d = uv_to_utf8(d, uv);
}
else if (uv == none) {
int i;
i = UTF8SKIP(s);
if (i > 1 && !isutf++)
- HALF_UPGRADE(dstart,d);
+ HALF_UTF8_UPGRADE(dstart,d);
while(i--)
- *d++ = *s++;
+ *d++ = *s++;
}
else if (uv == extra) {
int i;
s += i;
matches++;
if (i > 1 && !isutf++)
- HALF_UPGRADE(dstart,d);
+ HALF_UTF8_UPGRADE(dstart,d);
d = uv_to_utf8(d, final);
}
else
matches++;
if (uv != puv) {
if ((uv & 0x80) && !isutf++)
- HALF_UPGRADE(dst,d);
+ HALF_UTF8_UPGRADE(dst,d);
d = uv_to_utf8(d, uv);
puv = uv;
}
- s += UTF8SKIP(s);
+ s += UTF8SKIP(s);
continue;
}
else if (uv == none) { /* "none" is unmapped character */