diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-07-30 14:14:46 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-07-30 14:14:46 +0000 |
commit | 77ed5993fe6effc60c9a735c2b7b3aabf586af92 (patch) | |
tree | 610099df7a9e32c30bd3bce9cae5fd38503228a0 /io.c | |
parent | 875cea02664aab8c51a97edbbc5f22fbd2e88bd2 (diff) |
* io.c (rb_io_each_byte): rbuf can be refreshed during yield.
[Bug #5119]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@32758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -2829,13 +2829,10 @@ rb_io_each_byte(VALUE io) GetOpenFile(io, fptr); for (;;) { - p = fptr->rbuf.ptr+fptr->rbuf.off; - e = p + fptr->rbuf.len; - while (p < e) { - fptr->rbuf.off++; - fptr->rbuf.len--; + while (fptr->rbuf.len > 0) { + p = fptr->rbuf.ptr + fptr->rbuf.off++; + e = p + fptr->rbuf.len--; rb_yield(INT2FIX(*p & 0xff)); - p++; errno = 0; } rb_io_check_byte_readable(fptr); |