From b28d53bda9b374291fc4e98b3579911064b11e0c Mon Sep 17 00:00:00 2001 From: dearblue Date: Sat, 19 Oct 2024 10:59:21 +0900 Subject: [PATCH] Small improvements for `mrb_gc_register()` The `mrb_nil_p()` used in conditional expressions is semantically included in `!mrb_array_p()`. --- src/gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gc.c b/src/gc.c index a9549e730..6d76f7fae 100644 --- a/src/gc.c +++ b/src/gc.c @@ -431,7 +431,7 @@ mrb_gc_register(mrb_state *mrb, mrb_value obj) table = mrb_gv_get(mrb, GC_ROOT_SYM); int ai = mrb_gc_arena_save(mrb); mrb_gc_protect(mrb, obj); - if (mrb_nil_p(table) || !mrb_array_p(table)) { + if (!mrb_array_p(table)) { table = mrb_ary_new(mrb); mrb_gv_set(mrb, GC_ROOT_SYM, table); }