summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-20 14:26:23 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-20 14:26:23 +0000
commitaafc487d6a461d0a729432f919af0ee9645fcf14 (patch)
tree1016cf15bf582d4a037ecc210baf2f51fc16f70d /io.c
parenta0b500ac088667ae82b1fcd2ee0e5e51eb7f3f50 (diff)
* 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
Diffstat (limited to 'io.c')
-rw-r--r--io.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/io.c b/io.c
index 6059a974ee..f8237175df 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) {