diff options
author | Nicholas Clark <nick@ccl4.org> | 2007-10-22 11:46:55 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2007-10-22 11:46:55 +0000 |
commit | 694168e2c727557fd7c821a391f64b74290145ca (patch) | |
tree | 78b5310590ffa6d2e6cc428fa0b73bb11d04c7ec /mro.c | |
parent | dbef3c66e2761d118774f973c961faa9b1e467d9 (diff) | |
download | perl-694168e2c727557fd7c821a391f64b74290145ca.tar.gz |
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
Diffstat (limited to 'mro.c')
-rw-r--r-- | mro.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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); } } |