From: Nicholas Clark Date: Tue, 9 May 2006 20:10:12 +0000 (+0000) Subject: In Perl_Gv_AMupdate(), there's no need to call sv_unmagic() if we know X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=14899595d82ccba509ac7743655764129ed32177;p=p5sagit%2Fp5-mst-13.2.git 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 --- diff --git a/gv.c b/gv.c index c716c2b..c9861e9 100644 --- a/gv.c +++ b/gv.c @@ -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)) );