summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-05-09 20:10:12 +0000
committerNicholas Clark <nick@ccl4.org>2006-05-09 20:10:12 +0000
commit14899595d82ccba509ac7743655764129ed32177 (patch)
treeb838a65b23d5bb296558c956bdf40ed800c0ec00 /gv.c
parenta9fd4e40a4a3d556fd6cc1922cda2d372d2f7dbe (diff)
downloadperl-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
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c13
1 files 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)) );