1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* io.c (argf_readpartial): argf_forward needs argc and argv.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-08-15 21:29:10 +00:00
parent 3efcb087a3
commit e7e1b3a2d6
2 changed files with 17 additions and 4 deletions

View file

@ -1,3 +1,7 @@
Thu Aug 16 06:29:08 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (argf_readpartial): argf_forward needs argc and argv.
Thu Aug 16 02:47:39 2007 Koichi Sasada <ko1@atdot.net> Thu Aug 16 02:47:39 2007 Koichi Sasada <ko1@atdot.net>
* cont.c (rb_fiber_m_yield): added. use this function * cont.c (rb_fiber_m_yield): added. use this function

17
io.c
View file

@ -5384,9 +5384,16 @@ argf_read(int argc, VALUE *argv)
return str; return str;
} }
struct argf_call_arg {
int argc;
VALUE *argv;
};
static VALUE static VALUE
argf_readpartial_rescue(VALUE dummy) argf_forward_call(VALUE arg)
{ {
struct argf_call_arg *p = (struct argf_call_arg *)arg;
argf_forward(p->argc, p->argv);
return Qnil; return Qnil;
} }
@ -5406,9 +5413,11 @@ argf_readpartial(int argc, VALUE *argv)
rb_eof_error(); rb_eof_error();
} }
if (current_file == rb_stdin && TYPE(current_file) != T_FILE) { if (current_file == rb_stdin && TYPE(current_file) != T_FILE) {
tmp = rb_rescue2(argf_forward, (VALUE)argv, struct argf_call_arg arg;
argf_readpartial_rescue, (VALUE)Qnil, arg.argc = argc;
rb_eEOFError, (VALUE)0); arg.argv = argv;
tmp = rb_rescue2(argf_forward_call, (VALUE)&arg,
RUBY_METHOD_FUNC(0), Qnil, rb_eEOFError, (VALUE)0);
} }
else { else {
tmp = io_getpartial(argc, argv, current_file, 0); tmp = io_getpartial(argc, argv, current_file, 0);