summaryrefslogtreecommitdiff
path: root/mro.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-01-03 16:27:13 +0000
committerNicholas Clark <nick@ccl4.org>2008-01-03 16:27:13 +0000
commit4ea5041177724167b8ebcdd1a7c30762d7639fc4 (patch)
tree9b062ac4fd5017d33d4bf9a62c8b1bb5344fc1c2 /mro.c
parent09cae46f2f335675e85e10dbf61e95eeb6e56052 (diff)
downloadperl-4ea5041177724167b8ebcdd1a7c30762d7639fc4.tar.gz
We can now sv_upgrade(sv, SVt_PVHV), so do so, to simplify the code.
p4raw-id: //depot/perl@32815
Diffstat (limited to 'mro.c')
-rw-r--r--mro.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/mro.c b/mro.c
index 5f9bcfec32..f4014a8974 100644
--- a/mro.c
+++ b/mro.c
@@ -554,19 +554,12 @@ Perl_mro_isa_changed_in(pTHX_ HV* stash)
HE *he = hv_fetch_ent(PL_isarev, sv, TRUE, 0);
/* That fetch should not fail. But if it had to create a new SV for
- us, then we can detect it, because it will not be the correct type.
- Probably faster and cleaner for us to free that scalar [very little
- code actually executed to free it] and create a new HV than to
- copy&paste [SIN!] the code from newHV() to allow us to upgrade the
- new SV from SVt_NULL. */
+ us, then will need to upgrade it to an HV (which sv_upgrade() can
+ now do for us. */
mroisarev = (HV*)HeVAL(he);
- if(SvTYPE(mroisarev) != SVt_PVHV) {
- SvREFCNT_dec(mroisarev);
- mroisarev = newHV();
- HeVAL(he) = (SV *)mroisarev;
- }
+ SvUPGRADE((SV*)mroisarev, SVt_PVHV);
/* This hash only ever contains PL_sv_yes. Storing it over itself is
almost as cheap as calling hv_exists, so on aggregate we expect to