From 638bc8eb5003ba419ca7dda63f00eaa1f5299293 Mon Sep 17 00:00:00 2001 From: aamine Date: Sat, 20 Nov 2004 14:26:23 +0000 Subject: * io.c (rb_io_getline): f.gets("") did not work. [ruby-core:03771] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ io.c | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index a4a2a31cc..bb105f291 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sat Nov 20 23:25:12 2004 Minero Aoki + + * io.c (rb_io_getline): f.gets("") did not work. [ruby-core:03771] + Sat Nov 20 22:55:09 2004 WATANABE Hirofumi * test/runner.rb (CROSS_COMPILING): need to require rbconfig.rb before diff --git a/io.c b/io.c index 6059a974e..f8237175d 100644 --- a/io.c +++ b/io.c @@ -1448,10 +1448,14 @@ rb_io_getline(rs, fptr) } newline = rsptr[rslen - 1]; - while ((c = appendline(fptr, newline, &str)) != EOF && - (c != newline || RSTRING(str)->len < rslen || - (rspara || rscheck(rsptr,rslen,rs)) || - memcmp(RSTRING(str)->ptr+RSTRING(str)->len-rslen,rsptr,rslen))); + while ((c = appendline(fptr, newline, &str)) != EOF) { + if (c == newline) { + if (RSTRING(str)->len < rslen) continue; + if (!rspara) rscheck(rsptr, rslen, rs); + if (memcmp(RSTRING(str)->ptr + RSTRING(str)->len - rslen, + rsptr, rslen) == 0) break; + } + } if (rspara) { if (c != EOF) { -- cgit