Should not copy keys&values when a hash table is empty; fix #4270

This commit is contained in:
Yukihiro "Matz" Matsumoto
2019-02-11 15:19:20 +09:00
parent 639f6e2799
commit ef93ff6405
+1
View File
@@ -536,6 +536,7 @@ ht_copy(mrb_state *mrb, htable *t)
seg = t->rootseg;
t2 = ht_new(mrb);
if (t->size == 0) return t2;
while (seg) {
for (i=0; i<seg->size; i++) {