Reduce unnecessary mrb_obj_ptr() to mrb_check_frozen()

This commit is contained in:
Yukihiro "Matz" Matsumoto
2023-05-31 08:29:12 +09:00
parent afcf7fc86d
commit 8b39a7825d
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -624,7 +624,7 @@ mrb_mod_remove_method(mrb_state *mrb, mrb_value mod)
struct RClass *c = mrb_class_ptr(mod);
mrb_get_args(mrb, "*", &argv, &argc);
mrb_check_frozen(mrb, mrb_obj_ptr(mod));
mrb_check_frozen(mrb, c);
while (argc--) {
mrb_remove_method(mrb, c, mrb_obj_to_sym(mrb, *argv));
mrb_funcall_id(mrb, mod, MRB_SYM(method_removed), 1, *argv);
+3 -2
View File
@@ -504,10 +504,11 @@ MRB_API mrb_value
mrb_iv_remove(mrb_state *mrb, mrb_value obj, mrb_sym sym)
{
if (obj_iv_p(obj)) {
iv_tbl *t = mrb_obj_ptr(obj)->iv;
struct RObject *o = mrb_obj_ptr(obj);
iv_tbl *t = o->iv;
mrb_value val;
mrb_check_frozen(mrb, mrb_obj_ptr(obj));
mrb_check_frozen(mrb, o);
if (iv_del(mrb, t, sym, &val)) {
return val;
}