aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/io.c b/io.c
index a0b877e3ff..60f9241720 100644
--- a/io.c
+++ b/io.c
@@ -4807,19 +4807,11 @@ rb_io_open(const char *fname, const char *mode)
static VALUE
rb_io_open_with_args(int argc, VALUE *argv)
{
- const char *mode;
- VALUE pname, pmode;
+ VALUE io;
- if (rb_scan_args(argc, argv, "11", &pname, &pmode) == 1) {
- mode = "r";
- }
- else if (FIXNUM_P(pmode)) {
- mode = rb_io_modenum_mode(FIX2INT(pmode));
- }
- else {
- mode = StringValueCStr(pmode);
- }
- return rb_io_open(StringValueCStr(pname), mode);
+ io = io_alloc(rb_cFile);
+ rb_open_file(argc, argv, io);
+ return io;
}
static VALUE