From 59dbfa3e4cc8d4705ef5a4abd9904fa523f26bfa Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 2 Jan 2004 16:21:26 +0000 Subject: * dir.c: merge tuning from H.Yamamoto . [ruby-dev:22476] * io.c (argf_eof): ARGF.eof? should not have any side effect. [ruby-dev:22469] * io.c (argf_each_byte): should return self. [ruby-dev:22465] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index 40d8568bbf..fba74b8336 100644 --- a/io.c +++ b/io.c @@ -59,7 +59,7 @@ #include /* EMX has sys/param.h, but.. */ -#if defined(HAVE_SYS_PAAM_H) && !(defined(__EMX__) || defined(__HIUX_MPP__)) +#if defined(HAVE_SYS_PARAM_H) && !(defined(__EMX__) || defined(__HIUX_MPP__)) # include #endif @@ -1543,7 +1543,7 @@ rb_io_each_line(argc, argv, io) /* * call-seq: - * ios.each_byte {|byte| block } => nil + * ios.each_byte {|byte| block } => ios * * Calls the given block once for each byte (0..255) in ios, * passing the byte as an argument. The stream must be opened for @@ -4902,7 +4902,6 @@ argf_eof() if (init_p == 0) return Qtrue; ARGF_FORWARD(); if (rb_io_eof(current_file)) { - next_p = 1; return Qtrue; } } @@ -4940,7 +4939,7 @@ argf_read(argc, argv) } if (NIL_P(str)) str = tmp; else rb_str_append(str, tmp); - if (NIL_P(tmp) || NIL_P(argv[0])) { + if (NIL_P(tmp) || NIL_P(length)) { if (next_p != -1) { argf_close(current_file); next_p = 1; @@ -5021,7 +5020,7 @@ argf_each_byte() while (!NIL_P(byte = argf_getc())) { rb_yield(byte); } - return Qnil; + return argf; } static VALUE -- cgit v1.2.3