From: Jarkko Hietaniemi Date: Sun, 30 Jul 2000 18:36:22 +0000 (+0000) Subject: Fix the HALF_UPGRADE() macro introduced in #6263. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=075321c347d33b08156332124a97d603fca34e0f;p=p5sagit%2Fp5-mst-13.2.git Fix the HALF_UPGRADE() macro introduced in #6263. p4raw-id: //depot/perl@6467 --- diff --git a/doop.c b/doop.c index 3cdc23d..0139911 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 */