Upgrade to Locale::Maketext 1.07.
[p5sagit/p5-mst-13.2.git] / doop.c
diff --git a/doop.c b/doop.c
index e5c3d1c..ea64ff8 100644 (file)
--- a/doop.c
+++ b/doop.c
 #include "perl.h"
 
 #ifndef PERL_MICRO
-#if !defined(NSIG) || defined(M_UNIX) || defined(M_XENIX)
 #include <signal.h>
 #endif
-#endif
 
 STATIC I32
 S_do_trans_simple(pTHX_ SV *sv)
@@ -42,7 +40,7 @@ S_do_trans_simple(pTHX_ SV *sv)
     s = (U8*)SvPV(sv, len);
     send = s + len;
 
-    /* First, take care of non-UTF8 input strings, because they're easy */
+    /* First, take care of non-UTF-8 input strings, because they're easy */
     if (!SvUTF8(sv)) {
        while (s < send) {
            if ((ch = tbl[*s]) >= 0) {
@@ -74,7 +72,7 @@ S_do_trans_simple(pTHX_ SV *sv)
             s += ulen;
         }
        else { /* No match -> copy */
-           Copy(s, d, ulen, U8);
+           Move(s, d, ulen, U8);
            d += ulen;
            s += ulen;
         }
@@ -252,7 +250,7 @@ S_do_trans_complex(pTHX_ SV *sv)
                UV comp = utf8_to_uvchr(s, &len);
                if (comp > 0xff) {
                    if (!complement) {
-                       Copy(s, d, len, U8);
+                       Move(s, d, len, U8);
                        d += len;
                    }
                    else {
@@ -352,7 +350,7 @@ S_do_trans_simple_utf8(pTHX_ SV *sv)
        }
        else if (uv == none) {
            int i = UTF8SKIP(s);
-           Copy(s, d, i, U8);
+           Move(s, d, i, U8);
            d += i;
            s += i;
        }
@@ -511,7 +509,7 @@ S_do_trans_complex_utf8(pTHX_ SV *sv)
            }
            else if (uv == none) {      /* "none" is unmapped character */
                int i = UTF8SKIP(s);
-               Copy(s, d, i, U8);
+               Move(s, d, i, U8);
                d += i;
                s += i;
                puv = 0xfeedface;
@@ -530,7 +528,7 @@ S_do_trans_complex_utf8(pTHX_ SV *sv)
                    STRLEN len;
                    uv = utf8_to_uvuni(s, &len);
                    if (uv != puv) {
-                       Copy(s, d, len, U8);
+                       Move(s, d, len, U8);
                        d += len;
                        puv = uv;
                    }
@@ -562,7 +560,7 @@ S_do_trans_complex_utf8(pTHX_ SV *sv)
            }
            else if (uv == none) {      /* "none" is unmapped character */
                int i = UTF8SKIP(s);
-               Copy(s, d, i, U8);
+               Move(s, d, i, U8);
                d += i;
                s += i;
                continue;
@@ -617,7 +615,9 @@ Perl_do_trans(pTHX_ SV *sv)
 
     DEBUG_t( Perl_deb(aTHX_ "2.TBL\n"));
 
-    switch (PL_op->op_private & ~hasutf & 63) {
+    switch (PL_op->op_private & ~hasutf & (
+               OPpTRANS_FROM_UTF|OPpTRANS_TO_UTF|OPpTRANS_IDENTICAL|
+               OPpTRANS_SQUASH|OPpTRANS_DELETE|OPpTRANS_COMPLEMENT)) {
     case 0:
        if (hasutf)
            return do_trans_simple_utf8(sv);
@@ -669,7 +669,11 @@ Perl_do_join(pTHX_ register SV *sv, SV *del, register SV **mark, register SV **s
        ++mark;
     }
 
-    sv_setpv(sv, "");
+    sv_setpvn(sv, "", 0);
+    /* sv_setpv retains old UTF8ness [perl #24846] */
+    if (SvUTF8(sv))
+       SvUTF8_off(sv);
+
     if (PL_tainting && SvMAGICAL(sv))
        SvTAINTED_off(sv);