From e7f7ec8e0531a6168339bf1458d8b456992cff33 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: http://svn.ruby-lang.org/repos/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 b9c7eb7f8..db243c4e7 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