diff options
author | Nicholas Clark <nick@ccl4.org> | 2007-10-22 12:36:16 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2007-10-22 12:36:16 +0000 |
commit | ec49eb61487587a42bcd56c4dcb46adecfe24bd4 (patch) | |
tree | 0edfde65925528a856029e00823d87d6c5466fc6 /mro.c | |
parent | 117b69cacbec1246787bb24c539676f92ee1c4c7 (diff) | |
download | perl-ec49eb61487587a42bcd56c4dcb46adecfe24bd4.tar.gz |
hv_iterkeysv() actually creates a mortal SV for every call.
gv_stashsv() is just a wrapper for gv_stashpvn(), so doesn't need an
SV internally. Hence avoid creating lots of mortal SVs by using
hv_iterkey() to get the keys and lengths.
Also tweak whitespace in change 32168.
p4raw-id: //depot/perl@32169
Diffstat (limited to 'mro.c')
-rw-r--r-- | mro.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -518,8 +518,9 @@ Perl_mro_isa_changed_in(pTHX_ HV* stash) if(isarev) { hv_iterinit(isarev); while((iter = hv_iternext(isarev))) { - SV* const revkey = hv_iterkeysv(iter); - HV* revstash = gv_stashsv(revkey, 0); + I32 len; + const char* const revkey = hv_iterkey(iter, &len); + HV* revstash = gv_stashpvn(revkey, len, 0); struct mro_meta* revmeta; if(!revstash) continue; @@ -563,8 +564,8 @@ Perl_mro_isa_changed_in(pTHX_ HV* stash) if(SvTYPE(mroisarev) != SVt_PVHV) { SvREFCNT_dec(mroisarev); - mroisarev = newHV(); - HeVAL(he) = (SV *) mroisarev; + mroisarev = newHV(); + HeVAL(he) = (SV *)mroisarev; } /* This hash only ever contains PL_sv_yes. Storing it over itself is @@ -645,8 +646,9 @@ Perl_mro_method_changed_in(pTHX_ HV *stash) hv_iterinit(isarev); while((iter = hv_iternext(isarev))) { - SV* const revkey = hv_iterkeysv(iter); - HV* const revstash = gv_stashsv(revkey, 0); + I32 len; + const char* const revkey = hv_iterkey(iter, &len); + HV* const revstash = gv_stashpvn(revkey, len, 0); struct mro_meta* mrometa; if(!revstash) continue; |