From: Nicholas Clark Date: Mon, 22 Oct 2007 11:46:55 +0000 (+0000) Subject: S_mro_get_linear_isa_c3() doesn't need to call hv_fetch() then X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=694168e2c727557fd7c821a391f64b74290145ca;p=p5sagit%2Fp5-mst-13.2.git S_mro_get_linear_isa_c3() doesn't need to call hv_fetch() then hv_store(), as hv_fetch() can do it all for us. p4raw-id: //depot/perl@32167 --- diff --git a/mro.c b/mro.c index ed40bdd..aca1ee8 100644 --- a/mro.c +++ b/mro.c @@ -313,12 +313,13 @@ S_mro_get_linear_isa_c3(pTHX_ HV* stash, I32 level) SV** seq_ptr = AvARRAY(seq) + 1; while(seq_items--) { SV* const seqitem = *seq_ptr++; - HE* const he = hv_fetch_ent(tails, seqitem, 0, 0); - if(!he) { - (void)hv_store_ent(tails, seqitem, newSViv(1), 0); - } - else { + /* LVALUE fetch will create a new undefined SV if necessary + */ + HE* const he = hv_fetch_ent(tails, seqitem, 1, 0); + if(he) { SV* const val = HeVAL(he); + /* This will increment undef to 1, which is what we + want for a newly created entry. */ sv_inc(val); } }