Document the DJGPP status.
[p5sagit/p5-mst-13.2.git] / pp_hot.c
index 98229a2..ae1b1c2 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1699,17 +1699,8 @@ PP(pp_helem)
                    STRLEN keylen;
                    char *key = SvPV(keysv, keylen);
                    SAVEDELETE(hv, savepvn(key,keylen), keylen);
-               } else {
-                   SV *sv;
+               } else
                    save_helem(hv, keysv, svp);
-                   sv = *svp;
-                   /* If we're localizing a tied hash element, this new
-                    * sv won't actually be stored in the hash - so it
-                    * won't get reaped when the localize ends. Ensure it
-                    * gets reaped by mortifying it instead. DAPM */
-                   if (SvTIED_mg(sv, PERL_MAGIC_tiedelem))
-                       sv_2mortal(sv);
-               }
             }
        }
        else if (PL_op->op_private & OPpDEREF)
@@ -1992,8 +1983,21 @@ PP(pp_subst)
 
     /* known replacement string? */
     if (dstr) {
-        c = SvPV(dstr, clen);
-       doutf8 = DO_UTF8(dstr);
+       /* replacement needing upgrading? */
+       if (DO_UTF8(TARG) && !doutf8) {
+            SV *nsv = sv_newmortal();
+            SvSetSV(nsv, dstr);
+            if (PL_encoding)
+                 sv_recode_to_utf8(nsv, PL_encoding);
+            else
+                 sv_utf8_upgrade(nsv);
+            c = SvPV(nsv, clen);
+            doutf8 = TRUE;
+       }
+       else {
+           c = SvPV(dstr, clen);
+           doutf8 = DO_UTF8(dstr);
+       }
     }
     else {
         c = Nullch;
@@ -2098,6 +2102,8 @@ PP(pp_subst)
            SPAGAIN;
        }
        SvTAINT(TARG);
+       if (doutf8)
+           SvUTF8_on(TARG);
        LEAVE_SCOPE(oldsave);
        RETURN;
     }
@@ -2964,17 +2970,8 @@ PP(pp_aelem)
            PUSHs(lv);
            RETURN;
        }
-       if (PL_op->op_private & OPpLVAL_INTRO) {
-           SV *sv;
+       if (PL_op->op_private & OPpLVAL_INTRO)
            save_aelem(av, elem, svp);
-           sv = *svp;
-           /* If we're localizing a tied array element, this new sv
-            * won't actually be stored in the array - so it won't get
-            * reaped when the localize ends. Ensure it gets reaped by
-            * mortifying it instead. DAPM */
-           if (SvTIED_mg(sv, PERL_MAGIC_tiedelem))
-               sv_2mortal(sv);
-       }
        else if (PL_op->op_private & OPpDEREF)
            vivify_ref(*svp, PL_op->op_private & OPpDEREF);
     }