This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
COW formats (was Re: Smoke [5.9.0] 19044 FAIL(F) linux 2.4.18-3 (i686/1 cpu))
authorNicholas Clark <nick@ccl4.org>
Sun, 30 Mar 2003 00:35:48 +0000 (00:35 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Sun, 30 Mar 2003 07:49:46 +0000 (07:49 +0000)
Message-ID: <20030330003547.GO274@Bagpuss.unfortu.net>

p4raw-id: //depot/perl@19083

sv.c

diff --git a/sv.c b/sv.c
index 1fdd0c2..e7ec8e7 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -3683,8 +3683,16 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags)
            goto glob_assign;
        }
        break;
-    case SVt_PV:
     case SVt_PVFM:
+#ifdef PERL_COPY_ON_WRITE
+       if ((SvFLAGS(sstr) & CAN_COW_MASK) == CAN_COW_FLAGS) {
+           if (dtype < SVt_PVIV)
+               sv_upgrade(dstr, SVt_PVIV);
+           break;
+       }
+       /* Fall through */
+#endif
+    case SVt_PV:
        if (dtype < SVt_PV)
            sv_upgrade(dstr, SVt_PV);
        break;
@@ -4006,6 +4014,7 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags)
                 /* making another shared SV.  */
                 STRLEN cur = SvCUR(sstr);
                 STRLEN len = SvLEN(sstr);
+               assert (SvTYPE(dstr) >= SVt_PVIV);
                 if (len) {
                     /* SvIsCOW_normal */
                     /* splice us in between source and next-after-source.  */