static mrb_value mrb_struct_s_members_m(mrb_state *mrb, mrb_value klass) { mrb_value members, ary; members = struct_s_members(mrb, mrb_class_ptr(klass)); ary = mrb_ary_new_capa(mrb, RARRAY_LEN(members)); mrb_ary_replace(mrb, ary, members); return ary; }
mrb_value mrb_ary_replace_m(mrb_state *mrb, mrb_value self) { mrb_value other; mrb_get_args(mrb, "A", &other); mrb_ary_replace(mrb, self, other); return self; }
/* :nodoc: */ static mrb_value mrb_struct_init_copy(mrb_state *mrb, mrb_value copy) { mrb_value s; mrb_get_args(mrb, "o", &s); if (mrb_obj_equal(mrb, copy, s)) return copy; if (!mrb_obj_is_instance_of(mrb, s, mrb_obj_class(mrb, copy))) { mrb_raise(mrb, E_TYPE_ERROR, "wrong argument class"); } if (!mrb_array_p(s)) { mrb_raise(mrb, E_TYPE_ERROR, "corrupted struct"); } mrb_ary_replace(mrb, copy, s); return copy; }