Upgrade to podlators-2.0.2
[p5sagit/p5-mst-13.2.git] / sv.c
diff --git a/sv.c b/sv.c
index c8ad602..25d6f33 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -3260,25 +3260,18 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags)
        }
        (void)SvOK_off(dstr);
        SvRV_set(dstr, SvREFCNT_inc(SvRV(sstr)));
-       SvROK_on(dstr);
+       SvFLAGS(dstr) |= sflags & (SVf_IOK|SVp_IOK|SVf_NOK|SVp_NOK|SVf_ROK
+                                  |SVf_AMAGIC);
        if (sflags & SVp_NOK) {
-           SvNOKp_on(dstr);
-           /* Only set the public OK flag if the source has public OK.  */
-           if (sflags & SVf_NOK)
-               SvFLAGS(dstr) |= SVf_NOK;
            SvNV_set(dstr, SvNVX(sstr));
        }
        if (sflags & SVp_IOK) {
-           (void)SvIOKp_on(dstr);
-           if (sflags & SVf_IOK)
-               SvFLAGS(dstr) |= SVf_IOK;
+           /* Must do this otherwise some other overloaded use of 0x80000000
+              gets confused. Probably 0x80000000 */
            if (sflags & SVf_IVisUV)
                SvIsUV_on(dstr);
            SvIV_set(dstr, SvIVX(sstr));
        }
-       if (SvAMAGIC(sstr)) {
-           SvAMAGIC_on(dstr);
-       }
     }
     else if (sflags & SVp_POK) {
         bool isSwipe = 0;
@@ -3401,22 +3394,18 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags)
                 SvTEMP_off(sstr);
             }
         }
-       if (sflags & SVf_UTF8)
-           SvUTF8_on(dstr);
        if (sflags & SVp_NOK) {
-           SvNOKp_on(dstr);
-           if (sflags & SVf_NOK)
-               SvFLAGS(dstr) |= SVf_NOK;
            SvNV_set(dstr, SvNVX(sstr));
        }
        if (sflags & SVp_IOK) {
-           (void)SvIOKp_on(dstr);
-           if (sflags & SVf_IOK)
-               SvFLAGS(dstr) |= SVf_IOK;
+           SvRELEASE_IVX(dstr);
+           SvIV_set(dstr, SvIVX(sstr));
+           /* Must do this otherwise some other overloaded use of 0x80000000
+              gets confused. I guess SVpbm_VALID */
            if (sflags & SVf_IVisUV)
                SvIsUV_on(dstr);
-           SvIV_set(dstr, SvIVX(sstr));
        }
+       SvFLAGS(dstr) |= sflags & (SVf_IOK|SVp_IOK|SVf_NOK|SVp_NOK|SVf_UTF8);
        {
            const MAGIC * const smg = SvVOK(sstr);
            if (smg) {
@@ -3426,21 +3415,18 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags)
            }
        }
     }
-    else if (sflags & SVp_IOK) {
+    else if (sflags & (SVp_IOK|SVp_NOK)) {
        (void)SvOK_off(dstr);
-       /* XXXX Do we want to set IsUV for IV(ROK)?  Be extra safe... */
-       SvFLAGS(dstr) |= sflags & (SVf_IOK|SVp_IOK|SVf_IVisUV);
-       SvIV_set(dstr, SvIVX(sstr));
+       SvFLAGS(dstr) |= sflags & (SVf_IOK|SVp_IOK|SVf_IVisUV|SVf_NOK|SVp_NOK);
+       if (sflags & SVp_IOK) {
+           /* XXXX Do we want to set IsUV for IV(ROK)?  Be extra safe... */
+           SvIV_set(dstr, SvIVX(sstr));
+       }
        if (sflags & SVp_NOK) {
            SvFLAGS(dstr) |= sflags & (SVf_NOK|SVp_NOK);
            SvNV_set(dstr, SvNVX(sstr));
        }
     }
-    else if (sflags & SVp_NOK) {
-       (void)SvOK_off(dstr);
-       SvFLAGS(dstr) |= sflags & (SVf_NOK|SVp_NOK);
-       SvNV_set(dstr, SvNVX(sstr));
-    }
     else {
        if (dtype == SVt_PVGV) {
            if (ckWARN(WARN_MISC))