* io.c (rb_io_getline): f.gets("") did not work. [ruby-core:03771]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
aamine 2004-11-20 14:26:23 +00:00
parent a0b500ac08
commit aafc487d6a
2 changed files with 12 additions and 4 deletions

View File

@ -1,3 +1,7 @@
Sat Nov 20 23:25:12 2004 Minero Aoki <aamine@loveruby.net>
* io.c (rb_io_getline): f.gets("") did not work. [ruby-core:03771]
Sat Nov 20 22:55:09 2004 WATANABE Hirofumi <eban@ruby-lang.org> Sat Nov 20 22:55:09 2004 WATANABE Hirofumi <eban@ruby-lang.org>
* test/runner.rb (CROSS_COMPILING): need to require rbconfig.rb before * test/runner.rb (CROSS_COMPILING): need to require rbconfig.rb before

12
io.c
View File

@ -1448,10 +1448,14 @@ rb_io_getline(rs, fptr)
} }
newline = rsptr[rslen - 1]; newline = rsptr[rslen - 1];
while ((c = appendline(fptr, newline, &str)) != EOF && while ((c = appendline(fptr, newline, &str)) != EOF) {
(c != newline || RSTRING(str)->len < rslen || if (c == newline) {
(rspara || rscheck(rsptr,rslen,rs)) || if (RSTRING(str)->len < rslen) continue;
memcmp(RSTRING(str)->ptr+RSTRING(str)->len-rslen,rsptr,rslen))); if (!rspara) rscheck(rsptr, rslen, rs);
if (memcmp(RSTRING(str)->ptr + RSTRING(str)->len - rslen,
rsptr, rslen) == 0) break;
}
}
if (rspara) { if (rspara) {
if (c != EOF) { if (c != EOF) {