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

* io.c (rb_io_s_foreach): argument count check before making

Enumerator.  [ruby-dev:31525]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2007-08-20 14:46:03 +00:00
parent 5d51ae926b
commit 009debfd02
3 changed files with 5 additions and 2 deletions

View file

@ -6,6 +6,9 @@ Mon Aug 20 23:28:39 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* dir.c (dir_foreach): return Enumerator if no block given. * dir.c (dir_foreach): return Enumerator if no block given.
[ruby-dev:31525] [ruby-dev:31525]
* io.c (rb_io_s_foreach): argument count check before making
Enumerator. [ruby-dev:31525]
Mon Aug 20 23:17:14 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> Mon Aug 20 23:17:14 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_core.h (struct rb_thread_struct): removed first_func_arg and * vm_core.h (struct rb_thread_struct): removed first_func_arg and

2
io.c
View file

@ -5185,8 +5185,8 @@ rb_io_s_foreach(int argc, VALUE *argv, VALUE self)
VALUE fname; VALUE fname;
struct foreach_arg arg; struct foreach_arg arg;
RETURN_ENUMERATOR(self, argc, argv);
rb_scan_args(argc, argv, "12", &fname, NULL, NULL); rb_scan_args(argc, argv, "12", &fname, NULL, NULL);
RETURN_ENUMERATOR(self, argc, argv);
FilePathValue(fname); FilePathValue(fname);
arg.io = rb_io_open(RSTRING_PTR(fname), "r"); arg.io = rb_io_open(RSTRING_PTR(fname), "r");
if (NIL_P(arg.io)) return Qnil; if (NIL_P(arg.io)) return Qnil;