summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-04-25 09:41:08 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-04-25 09:41:08 +0000
commit60be77013646a8819276a5e3da1ae80b7bc35d8a (patch)
treeea783f672b0dfba383644b5bcc2ef6f19360a1c8
parenta268f439f21477489a1072e23ed564a6bb0bd4ae (diff)
* io.c (argf_read): read should not span two files. [ruby-dev:20073]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--io.c17
2 files changed, 8 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 3adead9f3a..39a9d693af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Fri Apr 25 18:40:07 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (argf_read): read should not span two files. [ruby-dev:20073]
+
Fri Apr 25 18:19:03 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (splat_value): split splat_value() and avalue_splat().
diff --git a/io.c b/io.c
index b7c525b1ff..ce9b76c1b3 100644
--- a/io.c
+++ b/io.c
@@ -113,7 +113,7 @@ struct timeval rb_time_interval _((VALUE));
static VALUE filename, current_file;
static int gets_lineno;
-static int init_p = 0, next_p = 0, first_p = 1;
+static int init_p = 0, next_p = 0;
static VALUE lineno;
#ifdef _STDIO_USES_IOSTREAM /* GNU libc */
@@ -2934,7 +2934,6 @@ next_argv()
filename = rb_str_new2("-");
}
init_p = 1;
- first_p = 0;
gets_lineno = 0;
}
@@ -3034,10 +3033,7 @@ argf_getline(argc, argv)
retry:
if (!next_argv()) return Qnil;
- if (TYPE(current_file) != T_FILE) {
- line = rb_funcall3(current_file, rb_intern("gets"), argc, argv);
- }
- else if (argc == 0 && rb_rs == rb_default_rs) {
+ if (argc == 0 && rb_rs == rb_default_rs) {
line = rb_io_gets(current_file);
}
else {
@@ -3719,7 +3715,7 @@ argf_read(argc, argv)
if (NIL_P(tmp) && next_p != -1) {
io_close(current_file);
next_p = 1;
- goto retry;
+ return str;
}
if (NIL_P(tmp) || RSTRING(tmp)->len == 0) return str;
else if (NIL_P(str)) str = tmp;
@@ -3743,12 +3739,7 @@ argf_getc()
retry:
if (!next_argv()) return Qnil;
- if (TYPE(current_file) != T_FILE) {
- byte = rb_funcall3(current_file, rb_intern("getc"), 0, 0);
- }
- else {
- byte = rb_io_getc(current_file);
- }
+ byte = rb_io_getc(current_file);
if (NIL_P(byte) && next_p != -1) {
io_close(current_file);
next_p = 1;