diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-30 13:30:11 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-30 13:30:11 +0000 |
commit | 9e3e19cd1fd923dc27fbbdfdde5fe88f1d0e106b (patch) | |
tree | f55bdc3cb5809f1b19e5b2450aed5637de62241b /ext/stringio/stringio.c | |
parent | c93f203e5392aef68d0e7b6e71a778bc13b558f5 (diff) | |
download | ruby-9e3e19cd1fd923dc27fbbdfdde5fe88f1d0e106b.tar.gz |
* 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
Diffstat (limited to 'ext/stringio/stringio.c')
-rw-r--r-- | ext/stringio/stringio.c | 4 |
1 files changed, 2 insertions, 2 deletions
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; } } |