This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In perl_clone_using(), turn off AvREAL() on param->stashes.
authorNicholas Clark <nick@ccl4.org>
Wed, 24 Feb 2010 15:07:51 +0000 (15:07 +0000)
committerNicholas Clark <nick@ccl4.org>
Mon, 24 May 2010 12:33:08 +0000 (13:33 +0100)
This is an optimisation, not a bug fix.

sv.c

diff --git a/sv.c b/sv.c
index 7ec4242..044c8bd 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -12100,6 +12100,13 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
     PL_origargv                = proto_perl->Iorigargv;
 
     param->stashes      = newAV();  /* Setup array of objects to call clone on */
+    /* This makes no difference to the implementation, as it always pushes
+       and shifts pointers to other SVs without changing their reference
+       count, with the array becoming empty before it is freed. However, it
+       makes it conceptually clear what is going on, and will avoid some
+       work inside av.c, filling slots between AvFILL() and AvMAX() with
+       &PL_sv_undef, and SvREFCNT_dec()ing those.  */
+    AvREAL_off(param->stashes);
 
     /* Set tainting stuff before PerlIO_debug can possibly get called */
     PL_tainting                = proto_perl->Itainting;