diff options
| author | Clayton Smith <[email protected]> | 2017-03-28 16:31:19 -0400 |
|---|---|---|
| committer | Clayton Smith <[email protected]> | 2017-03-28 16:31:19 -0400 |
| commit | a6e25f73a05bb0292c0c9f10b77c5cdaf260e4d0 (patch) | |
| tree | 6395c4e6dd2044a9b1ce955755c2101554ec1f58 /src/hash.c | |
| parent | 5ec051fc34a380687cbca463228131b013aa8db2 (diff) | |
| download | mruby-a6e25f73a05bb0292c0c9f10b77c5cdaf260e4d0.tar.gz mruby-a6e25f73a05bb0292c0c9f10b77c5cdaf260e4d0.zip | |
Renumber hash keys during dup since there may be duplicates.
Diffstat (limited to 'src/hash.c')
| -rw-r--r-- | src/hash.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/hash.c b/src/hash.c index d15faa206..3a7aea245 100644 --- a/src/hash.c +++ b/src/hash.c @@ -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; } } } |
