Make harness warning-free when running with -Mdiagnostics
[p5sagit/p5-mst-13.2.git] / mg.c
diff --git a/mg.c b/mg.c
index 5754732..31df285 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -85,7 +85,7 @@ S_save_magic(pTHX_ I32 mgs_ix, SV *sv)
 #ifdef PERL_OLD_COPY_ON_WRITE
     /* Turning READONLY off for a copy-on-write scalar is a bad idea.  */
     if (SvIsCOW(sv))
-      sv_force_normal(sv);
+      sv_force_normal_flags(sv, 0);
 #endif
 
     SAVEDESTRUCTOR_X(S_restore_magic, INT2PTR(void*, (IV)mgs_ix));
@@ -841,7 +841,10 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
 
              getrx:
                if (i >= 0) {
+                   int oldtainted = PL_tainted;
+                   TAINT_NOT;
                    sv_setpvn(sv, s, i);
+                   PL_tainted = oldtainted;
                    if (RX_MATCH_UTF8(rx) && is_utf8_string((U8*)s, i))
                        SvUTF8_on(sv);
                    else
@@ -2797,7 +2800,7 @@ S_restore_magic(pTHX_ const void *p)
        /* While magic was saved (and off) sv_setsv may well have seen
           this SV as a prime candidate for COW.  */
        if (SvIsCOW(sv))
-           sv_force_normal(sv);
+           sv_force_normal_flags(sv, 0);
 #endif
 
        if (mgs->mgs_flags)