diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-24 05:23:32 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-24 05:23:32 +0000 |
commit | d6e57faa4fbf12352c9fcd0cf36bfcbcf2d2a573 (patch) | |
tree | 2ec4e1c67c58d3f4851b3bb15902034afcbfb8e5 /ext/stringio | |
parent | 53568bcc4dfe51e5e0897b0dffd2adf7919a03af (diff) | |
download | ruby-d6e57faa4fbf12352c9fcd0cf36bfcbcf2d2a573.tar.gz ruby-d6e57faa4fbf12352c9fcd0cf36bfcbcf2d2a573.tar.xz ruby-d6e57faa4fbf12352c9fcd0cf36bfcbcf2d2a573.zip |
* ext/stringio/stringio.c (strio_read): clear the buffer argument
when returning nil. [ruby-dev:22363]
* test/ruby/ut_eof.rb (TestEOF::test_eof_0, TestEOF::test_eof_1):
add buffer argument tests.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/stringio')
-rw-r--r-- | ext/stringio/stringio.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index 1bab5b4d1..8d3275b2b 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -851,9 +851,11 @@ strio_read(argc, argv, self) } if (len > 0 && ptr->pos >= RSTRING(ptr->string)->len) { ptr->flags |= STRIO_EOF; + if (!NIL_P(str)) rb_str_resize(str, 0); return Qnil; } else if (ptr->flags & STRIO_EOF) { + if (!NIL_P(str)) rb_str_resize(str, 0); return Qnil; } break; |