summaryrefslogtreecommitdiff
path: root/av.c
diff options
context:
space:
mode:
authorBrandon Black <blblack@gmail.com>2007-08-12 06:36:14 -0700
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-08-31 09:07:51 +0000
commit89c14e2ec1b845cd5ec17986d2c65288a7da7ba8 (patch)
tree49daca85a19bfaf40679d19633871f2933add12b /av.c
parent53e0272ff6711924ddbd8568bad2a01574e7b545 (diff)
downloadperl-89c14e2ec1b845cd5ec17986d2c65288a7da7ba8.tar.gz
Re: optimize push @ISA, (was Re: parent.pm at http://corion.net/perl-dev)
From: "Brandon Black" <blblack@gmail.com> Message-ID: <84621a60708121336m13dcf9e5uac624fb246f2a79c@mail.gmail.com> p4raw-id: //depot/perl@31770
Diffstat (limited to 'av.c')
-rw-r--r--av.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/av.c b/av.c
index c1b03fee75..07d8e2266e 100644
--- a/av.c
+++ b/av.c
@@ -342,11 +342,14 @@ Perl_av_store(pTHX_ register AV *av, I32 key, SV *val)
SvREFCNT_dec(ary[key]);
ary[key] = val;
if (SvSMAGICAL(av)) {
+ const MAGIC* const mg = SvMAGIC(av);
if (val != &PL_sv_undef) {
- const MAGIC* const mg = SvMAGIC(av);
sv_magic(val, (SV*)av, toLOWER(mg->mg_type), 0, key);
}
- mg_set((SV*)av);
+ if (PL_delaymagic && mg->mg_type == PERL_MAGIC_isa)
+ PL_delaymagic |= DM_ARRAY;
+ else
+ mg_set((SV*)av);
}
return &ary[key];
}
@@ -428,8 +431,13 @@ Perl_av_clear(pTHX_ register AV *av)
Perl_croak(aTHX_ PL_no_modify);
/* Give any tie a chance to cleanup first */
- if (SvRMAGICAL(av))
- mg_clear((SV*)av);
+ if (SvRMAGICAL(av)) {
+ const MAGIC* const mg = SvMAGIC(av);
+ if (PL_delaymagic && mg->mg_type == PERL_MAGIC_isa)
+ PL_delaymagic |= DM_ARRAY;
+ else
+ mg_clear((SV*)av);
+ }
if (AvMAX(av) < 0)
return;