summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorArtur Bergman <sky@nanisky.com>2003-04-17 20:02:33 +0000
committerArtur Bergman <sky@nanisky.com>2003-04-17 20:02:33 +0000
commit281b276053f3a564bdb388e48f0a5b38c036197a (patch)
treec09d0b6b831212e22283dc00a230f67d029382a1 /sv.c
parent5e6160dc45a74849468013747b2649ba17c9faab (diff)
downloadperl-281b276053f3a564bdb388e48f0a5b38c036197a.tar.gz
Another needle in the voodoo doll.
Now I think it should work with the shared strings. p4raw-id: //depot/perl@19262
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sv.c b/sv.c
index 6a4dcf11bd..5a512697cc 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 */