summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/io.c b/io.c
index 5307ad4d3f..ddb6d9576a 100644
--- a/io.c
+++ b/io.c
@@ -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);