summaryrefslogtreecommitdiff
path: root/doop.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2000-07-30 18:36:22 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2000-07-30 18:36:22 +0000
commit075321c347d33b08156332124a97d603fca34e0f (patch)
tree2b12813841b35ec98d6a6d320a8460f694a0b360 /doop.c
parent551cd33c9579b0941c9f2eb742630b602b453bd6 (diff)
downloadperl-075321c347d33b08156332124a97d603fca34e0f.tar.gz
Fix the HALF_UPGRADE() macro introduced in #6263.
p4raw-id: //depot/perl@6467
Diffstat (limited to 'doop.c')
-rw-r--r--doop.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/doop.c b/doop.c
index 3cdc23d284..013991128f 100644
--- a/doop.c
+++ b/doop.c
@@ -21,16 +21,16 @@
#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)
{
@@ -240,16 +240,16 @@ S_do_trans_simple_utf8(pTHX_ SV *sv)/* SPC - OK */
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;
@@ -257,7 +257,7 @@ S_do_trans_simple_utf8(pTHX_ SV *sv)/* SPC - OK */
s += i;
matches++;
if (i > 1 && !isutf++)
- HALF_UPGRADE(dstart,d);
+ HALF_UTF8_UPGRADE(dstart,d);
d = uv_to_utf8(d, final);
}
else
@@ -353,11 +353,11 @@ S_do_trans_complex_utf8(pTHX_ SV *sv) /* SPC - NOT OK */
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 */