Changes to perlfaq8 "How do I find out if I'm running interactively
[p5sagit/p5-mst-13.2.git] / doop.c
diff --git a/doop.c b/doop.c
index 3143467..c4edb60 100644 (file)
--- a/doop.c
+++ b/doop.c
@@ -215,7 +215,7 @@ S_do_trans_complex(pTHX_ SV *sv)
 
                if (comp > 0xff) {
                    if (!complement) {
-                       Copy(s, d, len, U8);
+                       Move(s, d, len, U8);
                        d += len;
                    }
                    else {
@@ -243,7 +243,7 @@ S_do_trans_complex(pTHX_ SV *sv)
                    continue;
                }
                else if (ch == -1) {    /* -1 is unmapped character */
-                   Copy(s, d, len, U8);
+                   Move(s, d, len, U8);
                    d += len;
                }
                else if (ch == -2)      /* -2 is delete character */
@@ -278,7 +278,7 @@ S_do_trans_complex(pTHX_ SV *sv)
                    matches++;
                }
                else if (ch == -1) {    /* -1 is unmapped character */
-                   Copy(s, d, len, U8);
+                   Move(s, d, len, U8);
                    d += len;
                }
                else if (ch == -2)      /* -2 is delete character */
@@ -1185,7 +1185,6 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right)
     const bool left_utf = DO_UTF8(left);
     const bool right_utf = DO_UTF8(right);
     I32 needlen = 0;
-    bool needfree = FALSE;
 
     if (left_utf && !right_utf)
        sv_utf8_upgrade(right);
@@ -1203,7 +1202,6 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right)
     if ((left_utf || right_utf) && (sv == left || sv == right)) {
        needlen = optype == OP_BIT_AND ? len : leftlen + rightlen;
        Newxz(dc, needlen + 1, char);
-       needfree = TRUE;
     }
     else if (SvOK(sv) || SvTYPE(sv) > SVt_PVMG) {
        dc = SvPV_force_nomg_nolen(sv);
@@ -1241,10 +1239,8 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right)
                duc = luc & ruc;
                dc = (char*)uvchr_to_utf8((U8*)dc, duc);
            }
-           if (sv == left || sv == right) {
-               (void)sv_usepvn(sv, dcorig, needlen); /* Uses Renew(). */
-               needfree = FALSE; /* sv_usepvn() moved dcorig. */
-           }
+           if (sv == left || sv == right)
+               (void)sv_usepvn(sv, dcorig, needlen);
            SvCUR_set(sv, dc - dcorig);
            break;
        case OP_BIT_XOR:
@@ -1270,16 +1266,13 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right)
                duc = luc | ruc;
                dc = (char*)uvchr_to_utf8((U8*)dc, duc);
            }
-           goto mop_up_utf; /* For consistency. */
          mop_up_utf:
            if (rulen)
                dcsave = savepvn(rc, rulen);
            else if (lulen)
                dcsave = savepvn(lc, lulen);
-           if (sv == left || sv == right) {
+           if (sv == left || sv == right)
                (void)sv_usepvn(sv, dcorig, needlen); /* Uses Renew(). */
-               needfree = FALSE; /* sv_usepvn() moved dcorig. */
-           }
            SvCUR_set(sv, dc - dcorig);
            if (rulen)
                sv_catpvn(sv, dcsave, rulen);
@@ -1289,9 +1282,12 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right)
                *SvEND(sv) = '\0';
            Safefree(dcsave);
            break;
+       default:
+           if (sv == left || sv == right)
+               Safefree(dcorig);
+           Perl_croak(aTHX_ "panic: do_vop called for op %u (%s)", optype,
+                      PL_op_name[optype]);
        }
-       if (needfree)
-           Safefree(dcorig);
        SvUTF8_on(sv);
        goto finish;
     }