diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-08-02 18:01:39 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-08-25 09:16:01 +0900 |
| commit | 4c974b9523cc347a0bbcf46b759a14f0b60fdbf0 (patch) | |
| tree | 3341019089f481ee706b6e263e0ab4cfc3b8b6e2 /mrbgems | |
| parent | f3564a405ee766797be191cedd90aa3ab8b5e5c5 (diff) | |
| download | mruby-4c974b9523cc347a0bbcf46b759a14f0b60fdbf0.tar.gz mruby-4c974b9523cc347a0bbcf46b759a14f0b60fdbf0.zip | |
Small refactoring.
The macro `RCLASS_SUPER`, `RCLASS_IV_TBL` and `RCLASS_M_TBL` are
removed from `include/mruby/class.h`.
Diffstat (limited to 'mrbgems')
| -rw-r--r-- | mrbgems/mruby-struct/src/struct.c | 11 |
1 files changed, 5 insertions, 6 deletions
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); } } |
