diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-05-09 20:10:12 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-05-09 20:10:12 +0000 |
commit | 14899595d82ccba509ac7743655764129ed32177 (patch) | |
tree | b838a65b23d5bb296558c956bdf40ed800c0ec00 | |
parent | a9fd4e40a4a3d556fd6cc1922cda2d372d2f7dbe (diff) | |
download | perl-14899595d82ccba509ac7743655764129ed32177.tar.gz |
In Perl_Gv_AMupdate(), there's no need to call sv_unmagic() if we know
the magic isn't there.
p4raw-id: //depot/perl@28144
-rw-r--r-- | gv.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -1468,13 +1468,16 @@ Perl_Gv_AMupdate(pTHX_ HV *stash) { dVAR; MAGIC* const mg = mg_find((SV*)stash, PERL_MAGIC_overload_table); - AMT * const amtp = (mg) ? (AMT*)mg->mg_ptr: (AMT *) NULL; AMT amt; - if (mg && amtp->was_ok_am == PL_amagic_generation - && amtp->was_ok_sub == PL_sub_generation) - return (bool)AMT_OVERLOADED(amtp); - sv_unmagic((SV*)stash, PERL_MAGIC_overload_table); + if (mg) { + const AMT * const amtp = (AMT*)mg->mg_ptr; + if (amtp->was_ok_am == PL_amagic_generation + && amtp->was_ok_sub == PL_sub_generation) { + return (bool)AMT_OVERLOADED(amtp); + } + sv_unmagic((SV*)stash, PERL_MAGIC_overload_table); + } DEBUG_o( Perl_deb(aTHX_ "Recalcing overload magic in package %s\n",HvNAME_get(stash)) ); |