diff --git a/ChangeLog b/ChangeLog index 3be745a8bd..c494125600 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Aug 21 02:03:08 2008 Tanaka Akira + + * io.c (open_key_args): simplified. + Thu Aug 21 01:57:03 2008 Tanaka Akira * io.c (open_key_args): IO.foreach(path, rs, limit) didn't work. diff --git a/io.c b/io.c index 931692025d..ca3c1d5f2e 100644 --- a/io.c +++ b/io.c @@ -6690,12 +6690,9 @@ open_key_args(int argc, VALUE *argv, struct foreach_arg *arg) return; } v = rb_hash_aref(opt, sym_mode); - if (!NIL_P(v)) { - arg->io = rb_io_open(RSTRING_PTR(argv[0]), v, opt); - } - else { - arg->io = rb_io_open(RSTRING_PTR(argv[0]), INT2NUM(O_RDONLY), opt); - } + if (NIL_P(v)) + v = INT2NUM(O_RDONLY); + arg->io = rb_io_open(RSTRING_PTR(argv[0]), v, opt); } static VALUE