diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-28 08:03:19 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-28 08:03:19 +0000 |
commit | a19b53aeabbe0083ff826cc3beb0b90de5429922 (patch) | |
tree | 517813b0026ed773fe9a953705d45e02b31bd4b6 /hash.c | |
parent | 0c4466abba4f5ea0c3190049aeea5848ac4bae63 (diff) | |
download | bundler-a19b53aeabbe0083ff826cc3beb0b90de5429922.tar.gz |
hash.c: dry up code
* hash.c (rb_hash_update_{block,func}_callback): dry up hash
update callback code. [Fix GH-1338]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -2291,12 +2291,11 @@ rb_hash_update_block_callback(st_data_t *key, st_data_t *value, struct update_ar if (existing) { newvalue = rb_yield_values(3, (VALUE)*key, (VALUE)*value, newvalue); arg->old_value = *value; - arg->new_value = newvalue; } else { arg->new_key = *key; - arg->new_value = newvalue; } + arg->new_value = newvalue; *value = newvalue; return ST_CONTINUE; } @@ -2362,12 +2361,11 @@ rb_hash_update_func_callback(st_data_t *key, st_data_t *value, struct update_arg if (existing) { newvalue = (*uf_arg->func)((VALUE)*key, (VALUE)*value, newvalue); arg->old_value = *value; - arg->new_value = newvalue; } else { arg->new_key = *key; - arg->new_value = newvalue; } + arg->new_value = newvalue; *value = newvalue; return ST_CONTINUE; } |