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:
parent
5d51ae926b
commit
009debfd02
3 changed files with 5 additions and 2 deletions
|
@ -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.
|
||||
[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>
|
||||
|
||||
* vm_core.h (struct rb_thread_struct): removed first_func_arg and
|
||||
|
|
2
array.c
2
array.c
|
@ -922,7 +922,7 @@ rb_ary_rindex(int argc, VALUE *argv, VALUE ary)
|
|||
long i = RARRAY_LEN(ary);
|
||||
|
||||
if (rb_scan_args(argc, argv, "01", &val) == 0) {
|
||||
RETURN_ENUMERATOR(ary, 0, 0);
|
||||
RETURN_ENUMERATOR(ary, 0, 0);
|
||||
while (i--) {
|
||||
if (RTEST(rb_yield(RARRAY_PTR(ary)[i])))
|
||||
return LONG2NUM(i);
|
||||
|
|
2
io.c
2
io.c
|
@ -5185,8 +5185,8 @@ rb_io_s_foreach(int argc, VALUE *argv, VALUE self)
|
|||
VALUE fname;
|
||||
struct foreach_arg arg;
|
||||
|
||||
RETURN_ENUMERATOR(self, argc, argv);
|
||||
rb_scan_args(argc, argv, "12", &fname, NULL, NULL);
|
||||
RETURN_ENUMERATOR(self, argc, argv);
|
||||
FilePathValue(fname);
|
||||
arg.io = rb_io_open(RSTRING_PTR(fname), "r");
|
||||
if (NIL_P(arg.io)) return Qnil;
|
||||
|
|
Loading…
Reference in a new issue