summaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-20 17:03:27 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-20 17:03:27 +0000
commit7eb3e74e9aa13178b3077088eed91af7c7fd669d (patch)
tree15fc9f7323adaf287d0010f0607b2dfd7d907d98 /io.c
parent59892ad13a44bb31583d4f037c686c9897f12d4b (diff)
downloadruby-7eb3e74e9aa13178b3077088eed91af7c7fd669d.tar.gz
ruby-7eb3e74e9aa13178b3077088eed91af7c7fd669d.tar.xz
ruby-7eb3e74e9aa13178b3077088eed91af7c7fd669d.zip
* io.c (open_key_args): simplified.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/io.c b/io.c
index 931692025..ca3c1d5f2 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