From eca8a5a23a25bd5d13db45b643e146e82f9a9be9 Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 6 Dec 2004 08:40:30 +0000 Subject: * rubyio.h, intern.h, io.c, file.c, process.c, ext/socket/socket.c, ext/pty/pty.c, ext/io/wait/wait.c, ext/openssl/ossl_ssl.c: Use own buffering mechanism instead of stdio. * io.c, ext/stringio/stringio.c, test/ruby/ut_eof.rb: EOF flag removed. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/io/wait/wait.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'ext/io/wait') diff --git a/ext/io/wait/wait.c b/ext/io/wait/wait.c index 53d5bd7d1..df8d24c29 100644 --- a/ext/io/wait/wait.c +++ b/ext/io/wait/wait.c @@ -40,15 +40,12 @@ io_ready_p(io) VALUE io; { OpenFile *fptr; - FILE *fp; int n; GetOpenFile(io, fptr); rb_io_check_readable(fptr); - fp = fptr->f; - if (feof(fp)) return Qfalse; - if (rb_read_pending(fp)) return Qtrue; - if (ioctl(fileno(fp), FIONREAD, &n)) rb_sys_fail(0); + if (rb_io_read_pending(fptr)) return Qtrue; + if (ioctl(fptr->fd, FIONREAD, &n)) rb_sys_fail(0); if (n > 0) return INT2NUM(n); return Qnil; } @@ -68,7 +65,6 @@ io_wait(argc, argv, io) { OpenFile *fptr; fd_set rd; - FILE *fp; int fd, n; VALUE timeout; struct timeval *tp, timerec; @@ -84,16 +80,14 @@ io_wait(argc, argv, io) tp = &timerec; } - fp = fptr->f; - if (feof(fp)) return Qfalse; - if (rb_read_pending(fp)) return Qtrue; - fd = fileno(fp); + if (rb_io_read_pending(fptr)) return Qtrue; + fd = fptr->fd; FD_ZERO(&rd); FD_SET(fd, &rd); if (rb_thread_select(fd + 1, &rd, NULL, NULL, tp) < 0) rb_sys_fail(0); rb_io_check_closed(fptr); - if (ioctl(fileno(fp), FIONREAD, &n)) rb_sys_fail(0); + if (ioctl(fptr->fd, FIONREAD, &n)) rb_sys_fail(0); if (n > 0) return io; return Qnil; } -- cgit