Merge pull request #5718 from dearblue/rehash-iv_mt

Asigns table properties after `mrb_calloc()`
This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-06-10 10:44:14 +09:00
committed by GitHub
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -73,9 +73,9 @@ mt_rehash(mrb_state *mrb, mt_tbl *t)
khash_power2(new_alloc);
if (old_alloc == new_alloc) return;
t->ptr = (union mt_ptr*)mrb_calloc(mrb, sizeof(union mt_ptr)+sizeof(mrb_sym), new_alloc);
t->alloc = new_alloc;
t->size = 0;
t->ptr = (union mt_ptr*)mrb_calloc(mrb, sizeof(union mt_ptr)+sizeof(mrb_sym), new_alloc);
if (old_alloc == 0) return;
mrb_sym *keys = (mrb_sym*)&old_ptr[old_alloc];
+1 -1
View File
@@ -49,9 +49,9 @@ iv_rehash(mrb_state *mrb, iv_tbl *t)
khash_power2(new_alloc);
if (old_alloc == new_alloc) return;
t->ptr = (mrb_value*)mrb_calloc(mrb, sizeof(mrb_value)+sizeof(mrb_sym), new_alloc);
t->size = 0;
t->alloc = new_alloc;
t->ptr = (mrb_value*)mrb_calloc(mrb, sizeof(mrb_value)+sizeof(mrb_sym), new_alloc);
if (old_alloc == 0) return;
mrb_sym *keys = (mrb_sym*)&old_ptr[old_alloc];