From 9e3e19cd1fd923dc27fbbdfdde5fe88f1d0e106b Mon Sep 17 00:00:00 2001 From: mame Date: Mon, 30 Jun 2008 13:30:11 +0000 Subject: * ext/stringio/stringio.c (strio_getline): fix for nil and "" as separator. [ruby-dev:34591] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/stringio/stringio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/stringio') diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index b9c7eb7f80..db243c4e7e 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -835,7 +835,7 @@ strio_getline(int argc, VALUE *argv, struct StringIO *ptr) str = tmp; } } - else { + else if (!NIL_P(str)) { StringValue(str); } } @@ -862,7 +862,7 @@ strio_getline(int argc, VALUE *argv, struct StringIO *ptr) s = p; while ((p = memchr(p, '\n', e - p)) && (p != e)) { if (*++p == '\n') { - e = p; + e = p + 1; break; } } -- cgit v1.2.3