mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
class.c (mt_rehash): Fix mrb_calloc argument order
Since mrb_calloc() (along with mrb_calloc) takes two arguments: nmemb which is number of array elements, and size which is size of the array. Of course, revsersing does not change the behavior, but we'd like to respect the original design intention of calloc(3).
This commit is contained in:
+1
-1
@@ -78,7 +78,7 @@ mt_rehash(mrb_state *mrb, mt_tbl *t)
|
||||
int new_alloc = old_alloc > 0 ? old_alloc << 1 : 8;
|
||||
union mt_ptr *old_ptr = t->ptr;
|
||||
|
||||
t->ptr = (union mt_ptr*)mrb_calloc(mrb, sizeof(union mt_ptr)+sizeof(mrb_sym), new_alloc);
|
||||
t->ptr = (union mt_ptr*)mrb_calloc(mrb, new_alloc, sizeof(union mt_ptr)+sizeof(mrb_sym));
|
||||
t->alloc = new_alloc;
|
||||
t->size = 0;
|
||||
if (old_alloc == 0) return;
|
||||
|
||||
Reference in New Issue
Block a user