From: Nicholas Clark Date: Mon, 22 Oct 2007 12:36:16 +0000 (+0000) Subject: hv_iterkeysv() actually creates a mortal SV for every call. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ec49eb61487587a42bcd56c4dcb46adecfe24bd4;p=p5sagit%2Fp5-mst-13.2.git 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 --- diff --git a/mro.c b/mro.c index 95e0ef1..5f9bcfe 100644 --- a/mro.c +++ b/mro.c @@ -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;