From 4c974b9523cc347a0bbcf46b759a14f0b60fdbf0 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Thu, 2 Aug 2018 18:01:39 +0900 Subject: Small refactoring. The macro `RCLASS_SUPER`, `RCLASS_IV_TBL` and `RCLASS_M_TBL` are removed from `include/mruby/class.h`. --- mrbgems/mruby-struct/src/struct.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'mrbgems/mruby-struct/src/struct.c') diff --git a/mrbgems/mruby-struct/src/struct.c b/mrbgems/mruby-struct/src/struct.c index adeb09bc1..fe7e73f04 100644 --- a/mrbgems/mruby-struct/src/struct.c +++ b/mrbgems/mruby-struct/src/struct.c @@ -24,19 +24,18 @@ struct_class(mrb_state *mrb) } static inline mrb_value -struct_ivar_get(mrb_state *mrb, mrb_value c, mrb_sym id) +struct_ivar_get(mrb_state *mrb, mrb_value cls, mrb_sym id) { - struct RClass* kclass; + struct RClass* c = mrb_class_ptr(cls); struct RClass* sclass = struct_class(mrb); mrb_value ans; for (;;) { - ans = mrb_iv_get(mrb, c, id); + ans = mrb_iv_get(mrb, mrb_obj_value(c), id); if (!mrb_nil_p(ans)) return ans; - kclass = RCLASS_SUPER(c); - if (kclass == 0 || kclass == sclass) + c = c->super; + if (c == sclass || c == 0) return mrb_nil_value(); - c = mrb_obj_value(kclass); } } -- cgit v1.2.3