diff options
author | Nicholas Clark <nick@ccl4.org> | 2003-11-22 19:12:32 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2003-11-22 19:12:32 +0000 |
commit | 120fac9542f2e04bc96c6724be348c7e1481995d (patch) | |
tree | 6d2ff89424e1bd2c1951ab5600f8442e16374190 /sv.c | |
parent | 34a6f7b4e04e58809bc0044e4616028a0292c39e (diff) | |
download | perl-120fac9542f2e04bc96c6724be348c7e1481995d.tar.gz |
Don't COW if the destination has magic.
p4raw-id: //depot/perl@21773
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -3984,6 +3984,10 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags) * has to be allocated and SvPVX(sstr) has to be freed. */ + /* Whichever path we take through the next code, we want this true, + and doing it now facilitates the COW check. */ + (void)SvPOK_only(dstr); + if ( #ifdef PERL_COPY_ON_WRITE (sflags & (SVf_FAKE | SVf_READONLY)) != (SVf_FAKE | SVf_READONLY) @@ -3998,6 +4002,7 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags) !(PL_op && PL_op->op_type == OP_AASSIGN)) #ifdef PERL_COPY_ON_WRITE && !((sflags & CAN_COW_MASK) == CAN_COW_FLAGS + && (SvFLAGS(dstr) & CAN_COW_MASK) == CAN_COW_FLAGS && SvTYPE(sstr) >= SVt_PVIV) #endif ) { @@ -4008,7 +4013,6 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags) Move(SvPVX(sstr),SvPVX(dstr),len,char); SvCUR_set(dstr, len); *SvEND(dstr) = '\0'; - (void)SvPOK_only(dstr); } else { /* If PERL_COPY_ON_WRITE is not defined, then isSwipe will always be true in here. */ @@ -4046,7 +4050,6 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags) else if (SvLEN(dstr)) Safefree(SvPVX(dstr)); } - (void)SvPOK_only(dstr); #ifdef PERL_COPY_ON_WRITE if (!isSwipe) { |