From: Artur Bergman Date: Thu, 17 Apr 2003 20:02:33 +0000 (+0000) Subject: Another needle in the voodoo doll. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=281b276053f3a564bdb388e48f0a5b38c036197a;p=p5sagit%2Fp5-mst-13.2.git Another needle in the voodoo doll. Now I think it should work with the shared strings. p4raw-id: //depot/perl@19262 --- diff --git a/sv.c b/sv.c index 6a4dcf1..5a51269 100644 --- a/sv.c +++ b/sv.c @@ -9864,14 +9864,20 @@ Perl_rvpv_dup(pTHX_ SV *dstr, SV *sstr, CLONE_PARAMS* param) /* Special case - not normally malloced for some reason */ if (SvREADONLY(sstr) && SvFAKE(sstr)) { /* A "shared" PV - clone it as unshared string */ - if(!SvPADTMP(sstr)) { + if(SvPADTMP(sstr)) { /* However, some of them live in the pad and they should not have these flags turned off */ - SvFAKE_off(dstr); - SvREADONLY_off(dstr); + + SvPVX(dstr) = sharepvn(SvPVX(sstr), SvCUR(sstr), + SvUVX(sstr)); + SvUVX(dstr) = SvUVX(sstr); + } else { + + SvPVX(dstr) = SAVEPVN(SvPVX(sstr), SvCUR(sstr)); + SvFAKE_off(dstr); + SvREADONLY_off(dstr); } - SvPVX(dstr) = SAVEPVN(SvPVX(sstr), SvCUR(sstr)); } else { /* Some other special case - random pointer */