diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-11 04:46:56 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-11 04:46:56 +0000 |
commit | 8771d1a0fcf5c100885630a1e9a6bef1a44f32ff (patch) | |
tree | 57618fc69b2a15dc70e74307a1780a1d7cdcbc1f /vm.c | |
parent | 1571682719525d67ae355e4a0394c002f4aa30f1 (diff) | |
download | ruby-8771d1a0fcf5c100885630a1e9a6bef1a44f32ff.tar.gz |
vm.c: precedence of duplicated keys
* vm.c (kwmerge_i): override existing keys by new keys.
[ruby-core:65368] [Bug #10315]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r-- | vm.c | 12 |
1 files changed, 1 insertions, 11 deletions
@@ -2343,20 +2343,10 @@ m_core_hash_merge_ptr(int argc, VALUE *argv, VALUE recv) } static int -kwmerge_ii(st_data_t *key, st_data_t *value, st_data_t arg, int existing) -{ - if (existing) return ST_STOP; - *value = arg; - return ST_CONTINUE; -} - -static int kwmerge_i(VALUE key, VALUE value, VALUE hash) { if (!SYMBOL_P(key)) Check_Type(key, T_SYMBOL); - if (st_update(RHASH_TBL_RAW(hash), key, kwmerge_ii, (st_data_t)value) == 0) { /* !existing */ - RB_OBJ_WRITTEN(hash, Qundef, value); - } + rb_hash_aset(hash, key, value); return ST_CONTINUE; } |