error.c (mrb_sys_fail): errno argument removed from _sys_fail.

As a side effect, `errno.h` dependency removed from `error.c`.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-11-14 15:47:26 +09:00
parent 71a1d0ad26
commit a099ca44f4
2 changed files with 6 additions and 9 deletions
+2 -5
View File
@@ -4,7 +4,6 @@
** See Copyright Notice in mruby.h
*/
#include <errno.h>
#include <stdlib.h>
#include <mruby.h>
#include <mruby/array.h>
@@ -512,16 +511,14 @@ MRB_API mrb_noreturn void
mrb_sys_fail(mrb_state *mrb, const char *mesg)
{
struct RClass *sce;
mrb_int no;
no = (mrb_int)errno;
if (mrb_class_defined_id(mrb, MRB_SYM(SystemCallError))) {
sce = mrb_class_get_id(mrb, MRB_SYM(SystemCallError));
if (mesg != NULL) {
mrb_funcall_id(mrb, mrb_obj_value(sce), MRB_SYM(_sys_fail), 2, mrb_fixnum_value(no), mrb_str_new_cstr(mrb, mesg));
mrb_funcall_id(mrb, mrb_obj_value(sce), MRB_SYM(_sys_fail), 1, mrb_str_new_cstr(mrb, mesg));
}
else {
mrb_funcall_id(mrb, mrb_obj_value(sce), MRB_SYM(_sys_fail), 1, mrb_fixnum_value(no));
mrb_funcall_id(mrb, mrb_obj_value(sce), MRB_SYM(_sys_fail), 0);
}
}