From 14899595d82ccba509ac7743655764129ed32177 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Tue, 9 May 2006 20:10:12 +0000 Subject: [PATCH] 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 --- gv.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gv.c b/gv.c index c716c2befa..c9861e9111 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)) ); -- 2.34.1