summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-20 01:09:21 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-20 01:09:21 +0000
commitf761aacdd8689f92e29fe9cb659060f4df198db9 (patch)
tree81678ccd31ab6e16ee1e257fbecfffc8e91db074 /io.c
parentf1c975b87aa1ac6b50e53424ba8ff4a0c73985e9 (diff)
* io.c (open_key_args): set arg->io even if no options passed.
[ruby-dev:33072] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/io.c b/io.c
index d8e518fa87..1b98b6ae0d 100644
--- a/io.c
+++ b/io.c
@@ -5851,7 +5851,7 @@ open_key_args(int argc, VALUE *argv, struct foreach_arg *arg)
rb_ary_push(args, argv[0]);
rb_ary_concat(args, v);
MEMCPY(RARRAY_PTR(args)+1, RARRAY_PTR(v), VALUE, RARRAY_LEN(v));
-
+
arg->io = rb_f_open(RARRAY_LEN(args), RARRAY_PTR(args));
return;
}
@@ -5863,13 +5863,14 @@ open_key_args(int argc, VALUE *argv, struct foreach_arg *arg)
args[1] = v;
arg->io = rb_f_open(2, args);
}
+
+ if (!arg->io) {
+ arg->io = rb_io_open(RSTRING_PTR(argv[0]), "r");
+ }
+
v = rb_hash_aref(opt, encoding);
if (!NIL_P(v)) {
rb_io_t *fptr;
-
- if (!arg->io) {
- arg->io = rb_io_open(RSTRING_PTR(argv[0]), "r");
- }
GetOpenFile(arg->io, fptr);
mode_enc(fptr, StringValueCStr(v));
}