errno.c: stop generating Errno::Exxx error classes on the fly.

This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-01-26 12:29:19 +09:00
parent dd93dd7419
commit b7cdb59f26
-17
View File
@@ -102,7 +102,6 @@ mrb_sce_sys_fail(mrb_state *mrb, mrb_value cls)
mrb_value msg;
mrb_int no = -1;
int argc;
char name[8];
mrb->c->ci->mid = 0;
sce = mrb_class_get_id(mrb, MRB_SYM(SystemCallError));
@@ -115,22 +114,6 @@ mrb_sce_sys_fail(mrb_state *mrb, mrb_value cls)
}
exc = mrb_obj_value(e);
mrb_sce_init(mrb, exc, msg, no);
if (mrb_obj_class(mrb, exc) == sce && no > 0) {
struct RClass *m_errno = mrb_module_get_id(mrb, MRB_SYM(Errno));
struct RClass *cl;
snprintf(name, sizeof(name), "E%03d", (int)no);
mrb_sym esym = mrb_intern_cstr(mrb, name);
if (!mrb_const_defined_at(mrb, mrb_obj_value(m_errno), esym)) {
struct RClass *sce = mrb_class_get_id(mrb, MRB_SYM(SystemCallError));
cl = mrb_define_class_under_id(mrb, m_errno, esym, sce);
}
else {
cl = mrb_class_get_under_id(mrb, m_errno, esym);
}
e->c = cl;
}
mrb_exc_raise(mrb, exc);
return mrb_nil_value(); /* NOTREACHED */
}