summaryrefslogtreecommitdiff
path: root/mro.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-10-22 11:46:55 +0000
committerNicholas Clark <nick@ccl4.org>2007-10-22 11:46:55 +0000
commit694168e2c727557fd7c821a391f64b74290145ca (patch)
tree78b5310590ffa6d2e6cc428fa0b73bb11d04c7ec /mro.c
parentdbef3c66e2761d118774f973c961faa9b1e467d9 (diff)
downloadperl-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.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/mro.c b/mro.c
index ed40bdd9d9..aca1ee8abe 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);
}
}