summaryrefslogtreecommitdiff
path: root/pad.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-08-24 05:54:23 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-08-24 06:28:56 -0700
commitf2047bf1d09481734b45bedab1675f6f7b8d6de1 (patch)
tree6c9df49d5037b2b1d7a6a45e4c3af8df5b5fcd3e /pad.c
parent9d8c432ff8966d6c9001edbc15582fff801b08b3 (diff)
downloadperl-f2047bf1d09481734b45bedab1675f6f7b8d6de1.tar.gz
Don’t give unavailability warnings about our vars
Commit ce0d59fdd1c started using NULL to indicate nonexistent array elements. Since pads are AVs, they are filled with NULLs initially, rather than &PL_sv_undef. For ‘our’ vars, the pad entry is never actually touched. Only one piece of code was inspecting it, namely S_cv_clone_pad. &PL_sv_undef just happens to pass the checks that make sure the var is not stale. However, we really should not be checking that at all if this is an ‘our’ var. Even if we change ‘our’ vars back to having a &PL_sv_undef pad entry, this fix should stay, as it makes the code clearer and makes S_cv_clone_pad more robust.
Diffstat (limited to 'pad.c')
-rw-r--r--pad.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/pad.c b/pad.c
index 92765f0f79..a034d09227 100644
--- a/pad.c
+++ b/pad.c
@@ -2073,6 +2073,10 @@ S_cv_clone_pad(pTHX_ CV *proto, CV *cv, CV *outside, bool newcv)
SV* const namesv = (ix <= fname) ? pname[ix] : NULL;
SV *sv = NULL;
if (namesv && PadnameLEN(namesv)) { /* lexical */
+ if (PadnameIsOUR(namesv)) { /* or maybe not so lexical */
+ NOOP;
+ }
+ else {
if (SvFAKE(namesv)) { /* lexical from outside? */
/* formats may have an inactive, or even undefined, parent;
but state vars are always available. */
@@ -2126,6 +2130,7 @@ S_cv_clone_pad(pTHX_ CV *proto, CV *cv, CV *outside, bool newcv)
if (sigil != '&' && SvPAD_STATE(namesv))
SvPADSTALE_on(sv);
}
+ }
}
else if (IS_PADGV(ppad[ix]) || (namesv && PadnamePV(namesv))) {
sv = SvREFCNT_inc_NN(ppad[ix]);