summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorMarc-Andre Lafortune <github@marc-andre.ca>2021-03-15 22:15:03 -0400
committerMarc-Andre Lafortune <github@marc-andre.ca>2021-03-18 07:34:40 -0400
commit0ef2923c2b9afb76b3a1cebc56ebabc71c9a2ba8 (patch)
treea5572db3a246e53e1293823249e8ad4413ef061b /hash.c
parentd094c3ef046aba0bb99fd08bcbc72ff87216e736 (diff)
Avoid rehashing in Hash#replace/dup/initialize_copy [Bug #16996]
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hash.c b/hash.c
index 2dd61dcd3e..e9a3ca96d3 100644
--- a/hash.c
+++ b/hash.c
@@ -2958,7 +2958,7 @@ rb_hash_replace(VALUE hash, VALUE hash2)
RHASH_TBL_RAW(hash)->type = RHASH_ST_TABLE(hash2)->type;
}
}
- rb_hash_foreach(hash2, rb_hash_rehash_i, (VALUE)hash);
+ hash_copy(hash, hash2);
rb_gc_writebarrier_remember(hash);