From 540bd54ed394f80bc025598cb6eca1b3f3f66eed Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sun, 13 Oct 2024 21:38:46 +0900 Subject: [PATCH] variable.c (iv_rehash): name magic number 4 as IV_INITIAL_SIZE --- src/variable.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/variable.c b/src/variable.c index ee857140b..c4eacff8a 100644 --- a/src/variable.c +++ b/src/variable.c @@ -39,11 +39,13 @@ iv_new(mrb_state *mrb) static void iv_put(mrb_state *mrb, iv_tbl *t, mrb_sym sym, mrb_value val); +#define IV_INITIAL_SIZE 4 + static void iv_rehash(mrb_state *mrb, iv_tbl *t) { int old_alloc = t->alloc; - int new_alloc = old_alloc > 0 ? old_alloc << 1 : 4; + int new_alloc = old_alloc > 0 ? old_alloc << 1 : IV_INITIAL_SIZE; mrb_value *old_ptr = t->ptr; t->ptr = (mrb_value*)mrb_calloc(mrb, sizeof(mrb_value)+sizeof(mrb_sym), new_alloc);