diff options
author | David Mitchell <davem@iabyn.com> | 2015-11-08 19:19:02 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2016-02-03 09:18:32 +0000 |
commit | 520275ba7f707faa538ca41c5a6af2cab8fb566a (patch) | |
tree | dc46c8dd31ea79ba2d78ad29f2526a486b94cba7 /scope.c | |
parent | 3706fcea6257cb3ac83ac11700364056e0799895 (diff) | |
download | perl-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.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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!!! */ } |