summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-11-08 19:19:02 +0000
committerDavid Mitchell <davem@iabyn.com>2016-02-03 09:18:32 +0000
commit520275ba7f707faa538ca41c5a6af2cab8fb566a (patch)
treedc46c8dd31ea79ba2d78ad29f2526a486b94cba7 /scope.c
parent3706fcea6257cb3ac83ac11700364056e0799895 (diff)
downloadperl-520275ba7f707faa538ca41c5a6af2cab8fb566a.tar.gz
Perl_free_tmps(): don't test for PL_sv_undef
Each sv being popped off the tmps stack is compared against PL_sv_undef, and if so, the SvTEMP_off(sv); SvREFCNT_dec_NN(sv); is skipped. This condition was added by 8aacddc1 back in 2001, as part of a commit to add support for hash placeholders. Initially it used &PL_sv_undef in HE value slots to indicate a placeholder. In a later commit, that was changed to &PL_sv_placeholder, but the test in free_tmps() continued to test against &PL_sv_undef. Im not sure what the original intent was, but I strongly suspect that whatever purpose it may have originally served, it no longer served that after the switch to PL_sv_placeholder. On a purely pragmatic note, I can't see any harm in untemping PL_sv_undef; at worst its ref count will occasionally reach 0, and the special code in sv_free2() will reset its count to SvREFCNT_IMMORTAL. And no tests fail....
Diffstat (limited to 'scope.c')
-rw-r--r--scope.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/scope.c b/scope.c
index a39859d7a1..342e514d57 100644
--- a/scope.c
+++ b/scope.c
@@ -194,7 +194,7 @@ Perl_free_tmps(pTHX)
#ifdef PERL_POISON
PoisonWith(PL_tmps_stack + PL_tmps_ix + 1, 1, SV *, 0xAB);
#endif
- if (LIKELY(sv && sv != &PL_sv_undef)) {
+ if (LIKELY(sv)) {
SvTEMP_off(sv);
SvREFCNT_dec_NN(sv); /* note, can modify tmps_ix!!! */
}