From feaf80d8996340bd0316fda72418b1abd774bd59 Mon Sep 17 00:00:00 2001 From: KOBAYASHI Shuji Date: Thu, 26 Sep 2019 22:23:27 +0900 Subject: Use type predicate macros instead of `mrb_type` if possible For efficiency with `MRB_WORD_BOXING` (implement type predicate macros for all `enum mrb_vtype`). --- src/gc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gc.c') diff --git a/src/gc.c b/src/gc.c index a2a904477..835d1c61d 100644 --- a/src/gc.c +++ b/src/gc.c @@ -479,7 +479,7 @@ mrb_gc_register(mrb_state *mrb, mrb_value obj) if (mrb_immediate_p(obj)) return; root = mrb_intern_lit(mrb, GC_ROOT_NAME); table = mrb_gv_get(mrb, root); - if (mrb_nil_p(table) || mrb_type(table) != MRB_TT_ARRAY) { + if (mrb_nil_p(table) || !mrb_array_p(table)) { table = mrb_ary_new(mrb); mrb_gv_set(mrb, root, table); } @@ -499,7 +499,7 @@ mrb_gc_unregister(mrb_state *mrb, mrb_value obj) root = mrb_intern_lit(mrb, GC_ROOT_NAME); table = mrb_gv_get(mrb, root); if (mrb_nil_p(table)) return; - if (mrb_type(table) != MRB_TT_ARRAY) { + if (!mrb_array_p(table)) { mrb_gv_set(mrb, root, mrb_nil_value()); return; } -- cgit v1.2.3