mruby-io/io.c (io_init): remove redundant code

This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-12-29 14:30:45 +09:00
parent ef0b43d9a1
commit 0cdecd2e9e
+1 -8
View File
@@ -156,7 +156,7 @@ static int
io_mode_to_flags(mrb_state *mrb, mrb_value mode)
{
if (mrb_nil_p(mode)) {
return io_modestr_to_flags(mrb, "r");
return O_RDONLY;
}
else if (mrb_string_p(mode)) {
return io_modestr_to_flags(mrb, RSTRING_CSTR(mrb, mode));
@@ -704,13 +704,6 @@ io_init(mrb_state *mrb, mrb_value io)
check_file_descriptor(mrb, fd);
break;
}
if (mrb_nil_p(mode)) {
mode = mrb_str_new_cstr(mrb, "r");
}
if (mrb_nil_p(opt)) {
opt = mrb_hash_new(mrb);
}
flags = io_mode_to_flags(mrb, mode);
mrb_iv_set(mrb, io, MRB_IVSYM(buf), mrb_str_new_cstr(mrb, ""));