Use `c` specifier for `mrb_get_args`.
MODIFY
mrbgems/mruby-objectspace/src/mruby_objectspace.c
mrbgems/mruby-objectspace/src/mruby_objectspace.c
@@ -166,12 +166,8 @@ os_each_object_cb(mrb_state *mrb, struct RBasic *obj, void *ud)
static mrb_value
os_each_object(mrb_state *mrb, mrb_value self)
{
- mrb_value cls = mrb_nil_value();
- struct os_each_object_data d;
- mrb_get_args(mrb, "&!|C", &d.block, &cls);
-
- d.target_module = mrb_nil_p(cls) ? NULL : mrb_class_ptr(cls);
- d.count = 0;
+ struct os_each_object_data d = {0};
+ mrb_get_args(mrb, "&!|c", &d.block, &d.target_module);
mrb_objspace_each_objects(mrb, os_each_object_cb, &d);
return mrb_fixnum_value(d.count);
}
@@ -379,10 +375,8 @@ os_memsize_of_all_cb(mrb_state *mrb, struct RBasic *obj, void *d)
static mrb_value
os_memsize_of_all(mrb_state *mrb, mrb_value self)
{
- mrb_value type = mrb_nil_value();
struct os_memsize_of_all_cb_data data = { 0 };
- mrb_get_args(mrb, "|C", &type);
- data.type = mrb_class_ptr(type);
+ mrb_get_args(mrb, "|c", &data.type);
mrb_objspace_each_objects(mrb, os_memsize_of_all_cb, &data);
return mrb_fixnum_value(data.t);
}

MODIFY
src/class.c
src/class.c
@@ -1168,22 +1168,22 @@ mrb_prepend_module(mrb_state *mrb, struct RClass *c, struct RClass *m)
static mrb_value
mrb_mod_prepend_features(mrb_state *mrb, mrb_value mod)
{
- mrb_value klass;
+ struct RClass *c;
mrb_check_type(mrb, mod, MRB_TT_MODULE);
- mrb_get_args(mrb, "C", &klass);
- mrb_prepend_module(mrb, mrb_class_ptr(klass), mrb_class_ptr(mod));
+ mrb_get_args(mrb, "c", &c);
+ mrb_prepend_module(mrb, c, mrb_class_ptr(mod));
return mod;
}
static mrb_value
mrb_mod_append_features(mrb_state *mrb, mrb_value mod)
{
- mrb_value klass;
+ struct RClass *c;
mrb_check_type(mrb, mod, MRB_TT_MODULE);
- mrb_get_args(mrb, "C", &klass);
- mrb_include_module(mrb, mrb_class_ptr(klass), mrb_class_ptr(mod));
+ mrb_get_args(mrb, "c", &c);
+ mrb_include_module(mrb, c, mrb_class_ptr(mod));
return mod;
}

MODIFY
src/kernel.c
src/kernel.c
@@ -520,11 +520,11 @@ mrb_obj_is_instance_of(mrb_state *mrb, mrb_value obj, struct RClass* c)
static mrb_value
obj_is_instance_of(mrb_state *mrb, mrb_value self)
{
- mrb_value arg;
+ struct RClass *c;
- mrb_get_args(mrb, "C", &arg);
+ mrb_get_args(mrb, "c", &c);
- return mrb_bool_value(mrb_obj_is_instance_of(mrb, self, mrb_class_ptr(arg)));
+ return mrb_bool_value(mrb_obj_is_instance_of(mrb, self, c));
}
/* 15.3.1.3.24 */
@@ -557,11 +557,11 @@ obj_is_instance_of(mrb_state *mrb, mrb_value self)
static mrb_value
mrb_obj_is_kind_of_m(mrb_state *mrb, mrb_value self)
{
- mrb_value arg;
+ struct RClass *c;
- mrb_get_args(mrb, "C", &arg);
+ mrb_get_args(mrb, "c", &c);
- return mrb_bool_value(mrb_obj_is_kind_of(mrb, self, mrb_class_ptr(arg)));
+ return mrb_bool_value(mrb_obj_is_kind_of(mrb, self, c));
}
KHASH_DECLARE(st, mrb_sym, char, FALSE)

Use `c` specifier for `mrb_get_args`.