summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-15 15:38:17 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-15 15:38:17 +0000
commita0eb50c4d93a4ca69420dad37feb9bc944a74188 (patch)
treef4995683fc77002eeba11f31a113f37a2356b57b /io.c
parentd5159ddec85b45a37df2354e4b63c12a05e6091e (diff)
merges r21503 from trunk into ruby_1_9_!.
* io.c (appendline): reformed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@21556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/io.c b/io.c
index b4493846b2..247e94fa0d 100644
--- a/io.c
+++ b/io.c
@@ -2002,7 +2002,7 @@ appendline(rb_io_t *fptr, int delim, VALUE *strp, long *lp)
if (NEED_READCONV(fptr)) {
make_readconv(fptr, 0);
- while (1) {
+ do {
const char *p, *e;
int searchlen;
if (fptr->cbuf_len) {
@@ -2036,15 +2036,12 @@ appendline(rb_io_t *fptr, int delim, VALUE *strp, long *lp)
return (unsigned char)RSTRING_PTR(str)[RSTRING_LEN(str)-1];
}
}
-
- if (more_char(fptr) == -1) {
- *lp = limit;
- return EOF;
- }
- }
+ } while (more_char(fptr) != -1);
+ *lp = limit;
+ return EOF;
}
- while (1) {
+ do {
long pending = READ_DATA_PENDING_COUNT(fptr);
if (pending > 0) {
const char *p = READ_DATA_PENDING_PTR(fptr);
@@ -2068,15 +2065,13 @@ appendline(rb_io_t *fptr, int delim, VALUE *strp, long *lp)
*lp = limit;
if (e) return delim;
if (limit == 0)
- return (unsigned char)RSTRING_PTR(str)[RSTRING_LEN(str)-1];
+ return (unsigned char)RSTRING_PTR(str)[RSTRING_LEN(str)-1];
}
rb_thread_wait_fd(fptr->fd);
rb_io_check_closed(fptr);
- if (io_fillbuf(fptr) < 0) {
- *lp = limit;
- return EOF;
- }
- }
+ } while (io_fillbuf(fptr) >= 0);
+ *lp = limit;
+ return EOF;
}
static inline int