summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/hash.c b/hash.c
index 5405410fd1..e80051e737 100644
--- a/hash.c
+++ b/hash.c
@@ -1015,12 +1015,11 @@ VALUE
rb_hash_aset(VALUE hash, VALUE key, VALUE val)
{
rb_hash_modify(hash);
- if (RHASH(hash)->ntbl->type == &identhash ||
- rb_obj_class(key) != rb_cString || st_lookup(RHASH(hash)->ntbl, key, 0)) {
+ if (RHASH(hash)->ntbl->type == &identhash || rb_obj_class(key) != rb_cString) {
st_insert(RHASH(hash)->ntbl, key, val);
}
else {
- st_add_direct(RHASH(hash)->ntbl, rb_str_new4(key), val);
+ st_insert2(RHASH(hash)->ntbl, key, val, rb_str_new4);
}
return val;
}