Skip to content

Commit

Permalink
Renumber hash keys during dup since there may be duplicates.
Browse files Browse the repository at this point in the history
  • Loading branch information
clayton-shopify committed Mar 28, 2017
1 parent 5ec051f commit a6e25f7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ mrb_hash_dup(mrb_state *mrb, mrb_value hash)
int ai = mrb_gc_arena_save(mrb);
ret_k = kh_put(ht, mrb, ret_h, KEY(kh_key(h, k)));
mrb_gc_arena_restore(mrb, ai);
kh_val(ret_h, ret_k) = kh_val(h, k);
kh_val(ret_h, ret_k).v = kh_val(h, k).v;
kh_val(ret_h, ret_k).n = kh_size(ret_h)-1;
}
}
}
Expand Down

0 comments on commit a6e25f7

Please sign in to comment.