summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2002-08-15 01:10:35 +0100
committerhv <hv@crypt.org>2002-08-17 02:07:24 +0000
commit765f542df20317f47bb284c276cd0abfb50dcfd6 (patch)
treebe92963942496ba900bdfb32c5b522ba355aafb0 /mg.c
parent6f12eb6d2a1dfaf441504d869b27d2e40ef4966a (diff)
downloadperl-765f542df20317f47bb284c276cd0abfb50dcfd6.tar.gz
Copy On Write
Message-id: <20020815001035.A69079@plum.flirble.org> specify "-Accflags='-DPERL_COPY_ON_WRITE'" to use p4raw-id: //depot/perl@17728
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/mg.c b/mg.c
index 9e0b4fa16a..4432429621 100644
--- a/mg.c
+++ b/mg.c
@@ -57,6 +57,11 @@ S_save_magic(pTHX_ I32 mgs_ix, SV *sv)
{
MGS* mgs;
assert(SvMAGICAL(sv));
+#ifdef PERL_COPY_ON_WRITE
+ /* Turning READONLY off for a copy-on-write scalar is a bad idea. */
+ if (SvIsCOW(sv))
+ sv_force_normal(sv);
+#endif
SAVEDESTRUCTOR_X(restore_magic, INT2PTR(void*, (IV)mgs_ix));