This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
No need to clone pad name 0, as it's never used.
authorNicholas Clark <nick@ccl4.org>
Tue, 23 Nov 2010 11:46:43 +0000 (11:46 +0000)
committerNicholas Clark <nick@ccl4.org>
Tue, 23 Nov 2010 13:20:19 +0000 (13:20 +0000)
Pad entry 0 is for @_, but no name is recorded for it, so the name slot is
always &PL_sv_undef.

pad.c

diff --git a/pad.c b/pad.c
index 7d7b5eb..9b8cda5 100644 (file)
--- a/pad.c
+++ b/pad.c
@@ -1651,7 +1651,7 @@ Perl_cv_clone(pTHX_ CV *proto)
     CvPADLIST(cv) = pad_new(padnew_CLONE|padnew_SAVE);
 
     av_fill(PL_comppad, fpad);
-    for (ix = fname; ix >= 0; ix--)
+    for (ix = fname; ix > 0; ix--)
        av_store(PL_comppad_name, ix, SvREFCNT_inc(pname[ix]));
 
     PL_curpad = AvARRAY(PL_comppad);