Browse files

* rubyio.h (rb_io_t): renamed from OpenFile.

* ruby.h (struct RHash), file.c, gc.c, io.c, ext/dl/dl.c,
  ext/io/wait/wait.c, ext/pty/pty.c, ext/readline/readline.c,
  ext/socket/socket.c: ditto.

* win32/win32.h: removed workaround for OpenFile.


git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@16025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent 5631684 commit 946b98124af6e40459087adc835e9f14c83ef5e2 @nobu nobu committed Apr 15, 2008
Showing with 162 additions and 152 deletions.
  1. +10 −0 ChangeLog
  2. +1 −1 ext/dl/dl.c
  3. +2 −2 ext/io/wait/wait.c
  4. +1 −1 ext/pty/pty.c
  5. +1 −1 ext/readline/readline.c
  6. +39 −39 ext/socket/socket.c
  7. +13 −13 file.c
  8. +1 −1 gc.c
  9. +79 −79 io.c
  10. +1 −1 ruby.h
  11. +14 −11 rubyio.h
  12. +0 −3 win32/win32.h
View
10 ChangeLog
@@ -1,3 +1,13 @@
+Tue Apr 15 12:35:44 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * rubyio.h (rb_io_t): renamed from OpenFile.
+
+ * ruby.h (struct RHash), file.c, gc.c, io.c, ext/dl/dl.c,
+ ext/io/wait/wait.c, ext/pty/pty.c, ext/readline/readline.c,
+ ext/socket/socket.c: ditto.
+
+ * win32/win32.h: removed workaround for OpenFile.
+
Tue Apr 15 00:15:29 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk/text.rb: typo. call a wrong method.
View
2 ext/dl/dl.c
@@ -551,7 +551,7 @@ rb_ary_to_ptr(int argc, VALUE argv[], VALUE self)
VALUE
rb_io_to_ptr(VALUE self)
{
- OpenFile *fptr;
+ rb_io_t *fptr;
FILE *fp;
GetOpenFile(self, fptr);
View
4 ext/io/wait/wait.c
@@ -56,7 +56,7 @@ static VALUE
io_ready_p(io)
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
FILE *fp;
ioctl_arg n;
@@ -84,7 +84,7 @@ io_wait(argc, argv, io)
VALUE *argv;
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
fd_set rd;
FILE *fp;
int fd;
View
2 ext/pty/pty.c
@@ -416,7 +416,7 @@ pty_getpty(argc, argv, self)
VALUE res;
struct pty_info info;
struct pty_info thinfo;
- OpenFile *wfptr,*rfptr;
+ rb_io_t *wfptr,*rfptr;
VALUE rport = rb_obj_alloc(rb_cFile);
VALUE wport = rb_obj_alloc(rb_cFile);
char SlaveName[DEVICELEN];
View
2 ext/readline/readline.c
@@ -79,7 +79,7 @@ readline_readline(argc, argv, self)
char *prompt = NULL;
char *buff;
int status;
- OpenFile *ofp, *ifp;
+ rb_io_t *ofp, *ifp;
rb_secure(4);
if (rb_scan_args(argc, argv, "02", &tmp, &add_hist) > 0) {
View
78 ext/socket/socket.c
@@ -244,7 +244,7 @@ init_sock(sock, fd)
VALUE sock;
int fd;
{
- OpenFile *fp;
+ rb_io_t *fp;
MakeOpenFile(sock, fp);
fp->f = rb_fdopen(fd, "r");
@@ -259,7 +259,7 @@ static VALUE
bsock_s_for_fd(klass, fd)
VALUE klass, fd;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
VALUE sock = init_sock(rb_obj_alloc(klass), NUM2INT(fd));
GetOpenFile(sock, fptr);
@@ -275,7 +275,7 @@ bsock_shutdown(argc, argv, sock)
{
VALUE howto;
int how;
- OpenFile *fptr;
+ rb_io_t *fptr;
if (rb_safe_level() >= 4 && !OBJ_TAINTED(sock)) {
rb_raise(rb_eSecurityError, "Insecure: can't shutdown socket");
@@ -300,7 +300,7 @@ static VALUE
bsock_close_read(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
if (rb_safe_level() >= 4 && !OBJ_TAINTED(sock)) {
rb_raise(rb_eSecurityError, "Insecure: can't close socket");
@@ -319,7 +319,7 @@ static VALUE
bsock_close_write(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
if (rb_safe_level() >= 4 && !OBJ_TAINTED(sock)) {
rb_raise(rb_eSecurityError, "Insecure: can't close socket");
@@ -384,7 +384,7 @@ bsock_setsockopt(sock, lev, optname, val)
VALUE sock, lev, optname, val;
{
int level, option;
- OpenFile *fptr;
+ rb_io_t *fptr;
int i;
char *v;
int vlen;
@@ -467,7 +467,7 @@ bsock_getsockopt(sock, lev, optname)
int level, option;
socklen_t len;
char *buf;
- OpenFile *fptr;
+ rb_io_t *fptr;
level = NUM2INT(lev);
option = NUM2INT(optname);
@@ -491,7 +491,7 @@ bsock_getsockname(sock)
{
char buf[1024];
socklen_t len = sizeof buf;
- OpenFile *fptr;
+ rb_io_t *fptr;
GetOpenFile(sock, fptr);
if (getsockname(fileno(fptr->f), (struct sockaddr*)buf, &len) < 0)
@@ -505,7 +505,7 @@ bsock_getpeername(sock)
{
char buf[1024];
socklen_t len = sizeof buf;
- OpenFile *fptr;
+ rb_io_t *fptr;
GetOpenFile(sock, fptr);
if (getpeername(fileno(fptr->f), (struct sockaddr*)buf, &len) < 0)
@@ -521,7 +521,7 @@ bsock_send(argc, argv, sock)
{
VALUE mesg, to;
VALUE flags;
- OpenFile *fptr;
+ rb_io_t *fptr;
FILE *f;
int fd, n;
@@ -574,7 +574,7 @@ s_recvfrom(sock, argc, argv, from)
VALUE *argv;
enum sock_recv_type from;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
VALUE str;
char buf[1024];
socklen_t alen = sizeof buf;
@@ -644,7 +644,7 @@ s_recvfrom(sock, argc, argv, from)
static VALUE
s_recvfrom_nonblock(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
{
- OpenFile *fptr;
+ rb_io_t *fptr;
VALUE str;
char buf[1024];
socklen_t alen = sizeof buf;
@@ -1350,7 +1350,7 @@ static VALUE
socks_s_close(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
if (rb_safe_level() >= 4 && !OBJ_TAINTED(sock)) {
rb_raise(rb_eSecurityError, "Insecure: can't close socket");
@@ -1483,7 +1483,7 @@ make_fd_nonblock(int fd)
}
static VALUE
-s_accept_nonblock(VALUE klass, OpenFile *fptr, struct sockaddr *sockaddr, socklen_t *len)
+s_accept_nonblock(VALUE klass, rb_io_t *fptr, struct sockaddr *sockaddr, socklen_t *len)
{
int fd2;
@@ -1542,7 +1542,7 @@ static VALUE
tcp_accept(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct sockaddr_storage from;
socklen_t fromlen;
@@ -1585,7 +1585,7 @@ static VALUE
tcp_accept_nonblock(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct sockaddr_storage from;
socklen_t fromlen;
@@ -1599,7 +1599,7 @@ static VALUE
tcp_sysaccept(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct sockaddr_storage from;
socklen_t fromlen;
@@ -1630,7 +1630,7 @@ init_unixsock(sock, path, server)
{
struct sockaddr_un sockaddr;
int fd, status;
- OpenFile *fptr;
+ rb_io_t *fptr;
SafeStringValue(path);
fd = ruby_socket(AF_UNIX, SOCK_STREAM, 0);
@@ -1682,7 +1682,7 @@ static VALUE
ip_addr(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct sockaddr_storage addr;
socklen_t len = sizeof addr;
@@ -1697,7 +1697,7 @@ static VALUE
ip_peeraddr(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct sockaddr_storage addr;
socklen_t len = sizeof addr;
@@ -1778,7 +1778,7 @@ static VALUE
udp_connect(sock, host, port)
VALUE sock, host, port;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct udp_arg arg;
VALUE ret;
@@ -1796,7 +1796,7 @@ static VALUE
udp_bind(sock, host, port)
VALUE sock, host, port;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct addrinfo *res0, *res;
rb_secure(3);
@@ -1821,7 +1821,7 @@ udp_send(argc, argv, sock)
VALUE sock;
{
VALUE mesg, flags, host, port;
- OpenFile *fptr;
+ rb_io_t *fptr;
FILE *f;
int n;
struct addrinfo *res0, *res;
@@ -1920,7 +1920,7 @@ static VALUE
unix_path(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
GetOpenFile(sock, fptr);
if (fptr->path == 0) {
@@ -1967,7 +1967,7 @@ unix_send_io(sock, val)
{
#if defined(HAVE_SENDMSG) && (FD_PASSING_BY_MSG_CONTROL || FD_PASSING_BY_MSG_ACCRIGHTS)
int fd;
- OpenFile *fptr;
+ rb_io_t *fptr;
struct msghdr msg;
struct iovec vec[1];
char buf[1];
@@ -1980,7 +1980,7 @@ unix_send_io(sock, val)
#endif
if (rb_obj_is_kind_of(val, rb_cIO)) {
- OpenFile *valfptr;
+ rb_io_t *valfptr;
GetOpenFile(val, valfptr);
fd = fileno(valfptr->f);
}
@@ -2048,7 +2048,7 @@ unix_recv_io(argc, argv, sock)
{
#if defined(HAVE_RECVMSG) && (FD_PASSING_BY_MSG_CONTROL || FD_PASSING_BY_MSG_ACCRIGHTS)
VALUE klass, mode;
- OpenFile *fptr;
+ rb_io_t *fptr;
struct msghdr msg;
struct iovec vec[2];
char buf[1];
@@ -2152,7 +2152,7 @@ static VALUE
unix_accept(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct sockaddr_un from;
socklen_t fromlen;
@@ -2195,7 +2195,7 @@ static VALUE
unix_accept_nonblock(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct sockaddr_un from;
socklen_t fromlen;
@@ -2209,7 +2209,7 @@ static VALUE
unix_sysaccept(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct sockaddr_un from;
socklen_t fromlen;
@@ -2231,7 +2231,7 @@ static VALUE
unix_addr(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct sockaddr_un addr;
socklen_t len = sizeof addr;
@@ -2246,7 +2246,7 @@ static VALUE
unix_peeraddr(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct sockaddr_un addr;
socklen_t len = sizeof addr;
@@ -2526,7 +2526,7 @@ static VALUE
sock_connect(sock, addr)
VALUE sock, addr;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
int fd;
StringValue(addr);
@@ -2582,7 +2582,7 @@ static VALUE
sock_connect_nonblock(sock, addr)
VALUE sock, addr;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
int n;
StringValue(addr);
@@ -2680,7 +2680,7 @@ static VALUE
sock_bind(sock, addr)
VALUE sock, addr;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
StringValue(addr);
GetOpenFile(sock, fptr);
@@ -2764,7 +2764,7 @@ static VALUE
sock_listen(sock, log)
VALUE sock, log;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
int backlog;
rb_secure(4);
@@ -3040,7 +3040,7 @@ static VALUE
sock_accept(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
VALUE sock2;
char buf[1024];
socklen_t len = sizeof buf;
@@ -3103,7 +3103,7 @@ static VALUE
sock_accept_nonblock(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
VALUE sock2;
char buf[1024];
socklen_t len = sizeof buf;
@@ -3156,7 +3156,7 @@ static VALUE
sock_sysaccept(sock)
VALUE sock;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
VALUE sock2;
char buf[1024];
socklen_t len = sizeof buf;
View
26 file.c
@@ -138,7 +138,7 @@ static VALUE
rb_file_path(obj)
VALUE obj;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
fptr = RFILE(rb_io_taint_check(obj))->fptr;
rb_io_check_initialized(fptr);
@@ -652,7 +652,7 @@ rb_stat(file, st)
tmp = rb_check_convert_type(file, T_FILE, "IO", "to_io");
if (!NIL_P(tmp)) {
- OpenFile *fptr;
+ rb_io_t *fptr;
rb_secure(2);
GetOpenFile(tmp, fptr);
@@ -673,7 +673,7 @@ w32_io_info(file, st)
tmp = rb_check_convert_type(*file, T_FILE, "IO", "to_io");
if (!NIL_P(tmp)) {
- OpenFile *fptr;
+ rb_io_t *fptr;
GetOpenFile(tmp, fptr);
f = (HANDLE)rb_w32_get_osfhandle(fileno(fptr->f));
@@ -739,7 +739,7 @@ static VALUE
rb_io_stat(obj)
VALUE obj;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct stat st;
GetOpenFile(obj, fptr);
@@ -800,7 +800,7 @@ rb_file_lstat(obj)
VALUE obj;
{
#ifdef HAVE_LSTAT
- OpenFile *fptr;
+ rb_io_t *fptr;
struct stat st;
rb_secure(2);
@@ -1594,7 +1594,7 @@ static VALUE
rb_file_atime(obj)
VALUE obj;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct stat st;
GetOpenFile(obj, fptr);
@@ -1639,7 +1639,7 @@ static VALUE
rb_file_mtime(obj)
VALUE obj;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct stat st;
GetOpenFile(obj, fptr);
@@ -1687,7 +1687,7 @@ static VALUE
rb_file_ctime(obj)
VALUE obj;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
struct stat st;
GetOpenFile(obj, fptr);
@@ -1755,7 +1755,7 @@ static VALUE
rb_file_chmod(obj, vmode)
VALUE obj, vmode;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
int mode;
rb_secure(2);
@@ -1899,7 +1899,7 @@ static VALUE
rb_file_chown(obj, owner, group)
VALUE obj, owner, group;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
int o, g;
rb_secure(2);
@@ -3087,7 +3087,7 @@ static VALUE
rb_file_truncate(obj, len)
VALUE obj, len;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
FILE *f;
off_t pos;
@@ -3148,7 +3148,7 @@ cygwin_flock(int fd, int op)
static int
rb_thread_flock(fd, op, fptr)
int fd, op;
- OpenFile *fptr;
+ rb_io_t *fptr;
{
if (rb_thread_alone() || (op & LOCK_NB)) {
int ret;
@@ -3214,7 +3214,7 @@ rb_file_flock(obj, operation)
VALUE operation;
{
#ifndef __CHECKER__
- OpenFile *fptr;
+ rb_io_t *fptr;
int op;
rb_secure(2);
View
2 gc.c
@@ -35,7 +35,7 @@
#endif
void re_free_registers _((struct re_registers*));
-void rb_io_fptr_finalize _((struct OpenFile*));
+void rb_io_fptr_finalize _((struct rb_io_t*));
#define rb_setjmp(env) RUBY_SETJMP(env)
#define rb_jmp_buf rb_jmpbuf_t
View
158 io.c
@@ -219,7 +219,7 @@ rb_io_taint_check(io)
void
rb_io_check_initialized(fptr)
- OpenFile *fptr;
+ rb_io_t *fptr;
{
if (!fptr) {
rb_raise(rb_eIOError, "uninitialized stream");
@@ -228,19 +228,19 @@ rb_io_check_initialized(fptr)
void
rb_io_check_closed(fptr)
- OpenFile *fptr;
+ rb_io_t *fptr;
{
rb_io_check_initialized(fptr);
if (!fptr->f && !fptr->f2) {
rb_raise(rb_eIOError, "closed stream");
}
}
-static void io_fflush _((FILE *, OpenFile *));
+static void io_fflush _((FILE *, rb_io_t *));
-static OpenFile *
+static rb_io_t *
flush_before_seek(fptr)
- OpenFile *fptr;
+ rb_io_t *fptr;
{
if (fptr->mode & FMODE_WBUF) {
io_fflush(GetWriteFile(fptr), fptr);
@@ -262,7 +262,7 @@ flush_before_seek(fptr)
void
rb_io_check_readable(fptr)
- OpenFile *fptr;
+ rb_io_t *fptr;
{
rb_io_check_closed(fptr);
if (!(fptr->mode & FMODE_READABLE)) {
@@ -281,7 +281,7 @@ rb_io_check_readable(fptr)
void
rb_io_check_writable(fptr)
- OpenFile *fptr;
+ rb_io_t *fptr;
{
rb_io_check_closed(fptr);
if (!(fptr->mode & FMODE_WRITABLE)) {
@@ -346,7 +346,7 @@ io_alloc(klass)
static void
io_fflush(f, fptr)
FILE *f;
- OpenFile *fptr;
+ rb_io_t *fptr;
{
int n;
@@ -425,7 +425,7 @@ rb_io_wait_writable(f)
#endif
static int
-wsplit_p(OpenFile *fptr)
+wsplit_p(rb_io_t *fptr)
{
FILE *f = GetWriteFile(fptr);
int r;
@@ -449,7 +449,7 @@ wsplit_p(OpenFile *fptr)
static long
io_fwrite(str, fptr)
VALUE str;
- OpenFile *fptr;
+ rb_io_t *fptr;
{
long len, n, r, l, offset = 0;
FILE *f = GetWriteFile(fptr);
@@ -529,7 +529,7 @@ rb_io_fwrite(ptr, len, f)
long len;
FILE *f;
{
- OpenFile of;
+ rb_io_t of;
of.f = f;
of.f2 = NULL;
@@ -560,7 +560,7 @@ static VALUE
io_write(io, str)
VALUE io, str;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
long n;
rb_secure(4);
@@ -635,7 +635,7 @@ static VALUE
rb_io_flush(io)
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
FILE *f;
GetOpenFile(io, fptr);
@@ -664,7 +664,7 @@ static VALUE
rb_io_tell(io)
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
off_t pos;
GetOpenFile(io, fptr);
@@ -678,7 +678,7 @@ rb_io_seek(io, offset, whence)
VALUE io, offset;
int whence;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
off_t pos;
pos = NUM2OFFT(offset);
@@ -742,7 +742,7 @@ static VALUE
rb_io_set_pos(io, offset)
VALUE io, offset;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
off_t pos;
pos = NUM2OFFT(offset);
@@ -772,7 +772,7 @@ static VALUE
rb_io_rewind(io)
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
GetOpenFile(io, fptr);
if (io_seek(fptr, 0L, 0) != 0) rb_sys_fail(fptr->path);
@@ -821,7 +821,7 @@ VALUE
rb_io_eof(io)
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
int ch;
GetOpenFile(io, fptr);
@@ -861,7 +861,7 @@ static VALUE
rb_io_sync(io)
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
GetOpenFile(io, fptr);
return (fptr->mode & FMODE_SYNC) ? Qtrue : Qfalse;
@@ -886,7 +886,7 @@ static VALUE
rb_io_set_sync(io, mode)
VALUE io, mode;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
GetOpenFile(io, fptr);
if (RTEST(mode)) {
@@ -915,7 +915,7 @@ rb_io_fsync(io)
VALUE io;
{
#ifdef HAVE_FSYNC
- OpenFile *fptr;
+ rb_io_t *fptr;
FILE *f;
GetOpenFile(io, fptr);
@@ -947,7 +947,7 @@ static VALUE
rb_io_fileno(io)
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
int fd;
GetOpenFile(io, fptr);
@@ -979,7 +979,7 @@ static VALUE
rb_io_pid(io)
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
GetOpenFile(io, fptr);
if (!fptr->pid)
@@ -998,7 +998,7 @@ static VALUE
rb_io_inspect(obj)
VALUE obj;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
char *buf, *cname, *st = "";
long len;
@@ -1057,7 +1057,7 @@ static long
io_fread(ptr, len, fptr)
char *ptr;
long len;
- OpenFile *fptr;
+ rb_io_t *fptr;
{
long n = len;
int c;
@@ -1113,7 +1113,7 @@ rb_io_fread(ptr, len, f)
long len;
FILE *f;
{
- OpenFile of;
+ rb_io_t of;
of.f = f;
of.f2 = NULL;
@@ -1124,7 +1124,7 @@ rb_io_fread(ptr, len, f)
static long
remain_size(fptr)
- OpenFile *fptr;
+ rb_io_t *fptr;
{
struct stat st;
off_t siz = BUFSIZ;
@@ -1150,7 +1150,7 @@ remain_size(fptr)
static VALUE
read_all(fptr, siz, str)
- OpenFile *fptr;
+ rb_io_t *fptr;
long siz;
VALUE str;
{
@@ -1186,7 +1186,7 @@ read_all(fptr, siz, str)
return str;
}
-void rb_io_set_nonblock(OpenFile *fptr)
+void rb_io_set_nonblock(rb_io_t *fptr)
{
int flags;
#ifdef F_GETFL
@@ -1224,7 +1224,7 @@ void rb_io_set_nonblock(OpenFile *fptr)
static VALUE
io_getpartial(int argc, VALUE *argv, VALUE io, int nonblock)
{
- OpenFile *fptr;
+ rb_io_t *fptr;
VALUE length, str;
long n, len;
@@ -1407,7 +1407,7 @@ io_read_nonblock(int argc, VALUE *argv, VALUE io)
static VALUE
rb_io_write_nonblock(VALUE io, VALUE str)
{
- OpenFile *fptr;
+ rb_io_t *fptr;
FILE *f;
long n;
@@ -1454,7 +1454,7 @@ io_read(argc, argv, io)
VALUE *argv;
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
long n, len;
VALUE length, str;
@@ -1510,7 +1510,7 @@ io_read(argc, argv, io)
static int
appendline(fptr, delim, strp)
- OpenFile *fptr;
+ rb_io_t *fptr;
int delim;
VALUE *strp;
{
@@ -1615,7 +1615,7 @@ appendline(fptr, delim, strp)
static inline int
swallow(fptr, term)
- OpenFile *fptr;
+ rb_io_t *fptr;
int term;
{
FILE *f = fptr->f;
@@ -1654,7 +1654,7 @@ swallow(fptr, term)
static VALUE
rb_io_getline_fast(fptr, delim)
- OpenFile *fptr;
+ rb_io_t *fptr;
unsigned char delim;
{
VALUE str = Qnil;
@@ -1689,7 +1689,7 @@ rb_io_getline(rs, io)
VALUE rs, io;
{
VALUE str = Qnil;
- OpenFile *fptr;
+ rb_io_t *fptr;
GetOpenFile(io, fptr);
rb_io_check_readable(fptr);
@@ -1746,7 +1746,7 @@ VALUE
rb_io_gets(io)
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
GetOpenFile(io, fptr);
rb_io_check_readable(fptr);
@@ -1814,7 +1814,7 @@ static VALUE
rb_io_lineno(io)
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
GetOpenFile(io, fptr);
rb_io_check_readable(fptr);
@@ -1842,7 +1842,7 @@ static VALUE
rb_io_set_lineno(io, lineno)
VALUE io, lineno;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
GetOpenFile(io, fptr);
rb_io_check_readable(fptr);
@@ -1996,7 +1996,7 @@ static VALUE
rb_io_each_byte(io)
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
FILE *f;
int c;
@@ -2042,7 +2042,7 @@ VALUE
rb_io_getc(io)
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
FILE *f;
int c;
@@ -2126,7 +2126,7 @@ VALUE
rb_io_ungetc(io, c)
VALUE io, c;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
int cc = NUM2INT(c);
GetOpenFile(io, fptr);
@@ -2156,7 +2156,7 @@ static VALUE
rb_io_isatty(io)
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
GetOpenFile(io, fptr);
if (isatty(fileno(fptr->f)) == 0)
@@ -2166,7 +2166,7 @@ rb_io_isatty(io)
static void
fptr_finalize(fptr, noraise)
- OpenFile *fptr;
+ rb_io_t *fptr;
int noraise;
{
int n1 = 0, n2 = 0, f1, f2 = -1;
@@ -2211,7 +2211,7 @@ fptr_finalize(fptr, noraise)
static void
rb_io_fptr_cleanup(fptr, noraise)
- OpenFile *fptr;
+ rb_io_t *fptr;
int noraise;
{
if (fptr->finalize) {
@@ -2224,7 +2224,7 @@ rb_io_fptr_cleanup(fptr, noraise)
void
rb_io_fptr_finalize(fptr)
- OpenFile *fptr;
+ rb_io_t *fptr;
{
if (!fptr) return;
if (fptr->path) {
@@ -2240,7 +2240,7 @@ VALUE
rb_io_close(io)
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
int fd, fd2;
fptr = RFILE(io)->fptr;
@@ -2328,7 +2328,7 @@ static VALUE
rb_io_closed(io)
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
fptr = RFILE(io)->fptr;
rb_io_check_initialized(fptr);
@@ -2357,7 +2357,7 @@ static VALUE
rb_io_close_read(io)
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
int n;
if (rb_safe_level() >= 4 && !OBJ_TAINTED(io)) {
@@ -2402,7 +2402,7 @@ static VALUE
rb_io_close_write(io)
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
int n;
if (rb_safe_level() >= 4 && !OBJ_TAINTED(io)) {
@@ -2444,7 +2444,7 @@ rb_io_sysseek(argc, argv, io)
{
VALUE offset, ptrname;
int whence = SEEK_SET;
- OpenFile *fptr;
+ rb_io_t *fptr;
off_t pos;
if (rb_scan_args(argc, argv, "11", &offset, &ptrname) == 2) {
@@ -2482,7 +2482,7 @@ static VALUE
rb_io_syswrite(io, str)
VALUE io, str;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
FILE *f;
long n;
@@ -2530,7 +2530,7 @@ rb_io_sysread(argc, argv, io)
VALUE io;
{
VALUE len, str;
- OpenFile *fptr;
+ rb_io_t *fptr;
long n, ilen;
rb_scan_args(argc, argv, "11", &len, &str);
@@ -2593,7 +2593,7 @@ rb_io_binmode(io)
VALUE io;
{
#if defined(_WIN32) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__EMX__)
- OpenFile *fptr;
+ rb_io_t *fptr;
GetOpenFile(io, fptr);
#ifdef __human68k__
@@ -2887,7 +2887,7 @@ rb_file_open_internal(io, fname, mode)
VALUE io;
const char *fname, *mode;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
MakeOpenFile(io, fptr);
@@ -2911,7 +2911,7 @@ rb_file_sysopen_internal(io, fname, flags, mode)
char *fname;
int flags, mode;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
int fd;
char *m;
@@ -2936,13 +2936,13 @@ rb_file_sysopen(fname, flags, mode)
#if defined (_WIN32) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__VMS)
static struct pipe_list {
- OpenFile *fptr;
+ rb_io_t *fptr;
struct pipe_list *next;
} *pipe_list;
static void
pipe_add_fptr(fptr)
- OpenFile *fptr;
+ rb_io_t *fptr;
{
struct pipe_list *list;
@@ -2954,7 +2954,7 @@ pipe_add_fptr(fptr)
static void
pipe_del_fptr(fptr)
- OpenFile *fptr;
+ rb_io_t *fptr;
{
struct pipe_list *list = pipe_list;
struct pipe_list *tmp;
@@ -2989,11 +2989,11 @@ pipe_atexit _((void))
}
}
-static void pipe_finalize _((OpenFile *fptr,int));
+static void pipe_finalize _((rb_io_t *fptr,int));
static void
pipe_finalize(fptr, noraise)
- OpenFile *fptr;
+ rb_io_t *fptr;
int noraise;
{
#if !defined (__CYGWIN__) && !defined(_WIN32)
@@ -3019,14 +3019,14 @@ pipe_finalize(fptr, noraise)
void
rb_io_synchronized(fptr)
- OpenFile *fptr;
+ rb_io_t *fptr;
{
fptr->mode |= FMODE_SYNC;
}
void
rb_io_unbuffered(fptr)
- OpenFile *fptr;
+ rb_io_t *fptr;
{
rb_io_synchronized(fptr);
}
@@ -3039,7 +3039,7 @@ pipe_open(pstr, pname, mode)
char *pname, *mode;
{
int modef = rb_io_mode_flags(mode);
- OpenFile *fptr;
+ rb_io_t *fptr;
#if defined(DJGPP) || defined(__human68k__) || defined(__VMS)
FILE *f;
#else
@@ -3516,7 +3516,7 @@ rb_io_check_io(io)
static char*
rb_io_mode_string(fptr)
- OpenFile *fptr;
+ rb_io_t *fptr;
{
switch (fptr->mode & FMODE_READWRITE) {
case FMODE_READABLE:
@@ -3533,7 +3533,7 @@ static VALUE
io_reopen(io, nfile)
VALUE io, nfile;
{
- OpenFile *fptr, *orig;
+ rb_io_t *fptr, *orig;
char *mode;
int fd, fd2;
off_t pos = 0;
@@ -3559,7 +3559,7 @@ io_reopen(io, nfile)
io_fflush(GetWriteFile(fptr), fptr);
}
- /* copy OpenFile structure */
+ /* copy rb_io_t structure */
fptr->mode = orig->mode;
fptr->pid = orig->pid;
fptr->lineno = orig->lineno;
@@ -3651,7 +3651,7 @@ rb_io_reopen(argc, argv, file)
{
VALUE fname, nmode;
char *mode;
- OpenFile *fptr;
+ rb_io_t *fptr;
rb_secure(4);
if (rb_scan_args(argc, argv, "11", &fname, &nmode) == 1) {
@@ -3665,8 +3665,8 @@ rb_io_reopen(argc, argv, file)
rb_io_taint_check(file);
fptr = RFILE(file)->fptr;
if (!fptr) {
- fptr = RFILE(file)->fptr = ALLOC(OpenFile);
- MEMZERO(fptr, OpenFile, 1);
+ fptr = RFILE(file)->fptr = ALLOC(rb_io_t);
+ MEMZERO(fptr, rb_io_t, 1);
}
if (!NIL_P(nmode)) {
@@ -3711,7 +3711,7 @@ static VALUE
rb_io_init_copy(dest, io)
VALUE dest, io;
{
- OpenFile *fptr, *orig;
+ rb_io_t *fptr, *orig;
int fd;
char *mode;
@@ -3731,7 +3731,7 @@ rb_io_init_copy(dest, io)
fseeko(orig->f, 0L, SEEK_CUR);
}
- /* copy OpenFile structure */
+ /* copy rb_io_t structure */
fptr->mode = orig->mode;
fptr->pid = orig->pid;
fptr->lineno = orig->lineno;
@@ -4182,7 +4182,7 @@ prep_stdio(f, mode, klass)
int mode;
VALUE klass;
{
- OpenFile *fp;
+ rb_io_t *fp;
VALUE io = io_alloc(klass);
MakeOpenFile(io, fp);
@@ -4203,7 +4203,7 @@ prep_path(io, path)
VALUE io;
char *path;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
GetOpenFile(io, fptr);
if (fptr->path) rb_bug("illegal prep_path() call");
@@ -4235,7 +4235,7 @@ rb_io_initialize(argc, argv, io)
VALUE io;
{
VALUE fnum, mode;
- OpenFile *fp;
+ rb_io_t *fp;
int fd, flags;
rb_secure(4);
@@ -4392,7 +4392,7 @@ next_argv()
{
extern VALUE rb_argv;
char *fn;
- OpenFile *fptr;
+ rb_io_t *fptr;
int stdout_binmode = 0;
if (TYPE(rb_stdout) == T_FILE) {
@@ -4699,7 +4699,7 @@ rb_f_backquote(obj, str)
{
volatile VALUE port;
VALUE result;
- OpenFile *fptr;
+ rb_io_t *fptr;
SafeStringValue(str);
port = pipe_open(str, 0, "r");
@@ -4736,7 +4736,7 @@ rb_f_select(argc, argv, obj)
fd_set rset, wset, eset, pset;
fd_set *rp, *wp, *ep;
struct timeval *tp, timerec;
- OpenFile *fptr;
+ rb_io_t *fptr;
long i;
int max = 0, n;
int interrupt_flag = 0;
@@ -4898,7 +4898,7 @@ rb_io_ctl(io, req, arg, io_p)
{
#if !defined(MSDOS) && !defined(__human68k__)
int cmd = NUM2ULONG(req);
- OpenFile *fptr;
+ rb_io_t *fptr;
long len = 0;
long narg = 0;
int retval;
View
2 ruby.h
@@ -390,7 +390,7 @@ struct RHash {
struct RFile {
struct RBasic basic;
- struct OpenFile *fptr;
+ struct rb_io_t *fptr;
};
struct RData {
View
25 rubyio.h
@@ -20,15 +20,18 @@
#include <stdio_ext.h>
#endif
-typedef struct OpenFile {
+typedef struct rb_io_t {
FILE *f; /* stdio ptr for read/write */
FILE *f2; /* additional ptr for rw pipes */
int mode; /* mode flags */
int pid; /* child's pid (for pipes) */
int lineno; /* number of lines read */
char *path; /* pathname for file */
- void (*finalize) _((struct OpenFile*,int)); /* finalize proc */
-} OpenFile;
+ void (*finalize) _((struct rb_io_t*,int)); /* finalize proc */
+} rb_io_t;
+
+#define HAVE_RB_IO_T 1
+#define OpenFile rb_io_t /* for backward compatibility */
#define FMODE_READABLE 1
#define FMODE_WRITABLE 2
@@ -51,7 +54,7 @@ typedef struct OpenFile {
RFILE(obj)->fptr = 0;\
}\
fp = 0;\
- fp = RFILE(obj)->fptr = ALLOC(OpenFile);\
+ fp = RFILE(obj)->fptr = ALLOC(rb_io_t);\
fp->f = fp->f2 = NULL;\
fp->mode = 0;\
fp->pid = 0;\
@@ -70,15 +73,15 @@ long rb_io_fread _((char *, long, FILE *));
long rb_io_fwrite _((const char *, long, FILE *));
int rb_io_mode_flags _((const char*));
int rb_io_modenum_flags _((int));
-void rb_io_check_writable _((OpenFile*));
-void rb_io_check_readable _((OpenFile*));
-void rb_io_fptr_finalize _((OpenFile*));
-void rb_io_synchronized _((OpenFile*));
-void rb_io_check_initialized _((OpenFile*));
-void rb_io_check_closed _((OpenFile*));
+void rb_io_check_writable _((rb_io_t*));
+void rb_io_check_readable _((rb_io_t*));
+void rb_io_fptr_finalize _((rb_io_t*));
+void rb_io_synchronized _((rb_io_t*));
+void rb_io_check_initialized _((rb_io_t*));
+void rb_io_check_closed _((rb_io_t*));
int rb_io_wait_readable _((int));
int rb_io_wait_writable _((int));
-void rb_io_set_nonblock(OpenFile *fptr);
+void rb_io_set_nonblock(rb_io_t *fptr);
VALUE rb_io_taint_check _((VALUE));
NORETURN(void rb_eof_error _((void)));
View
3 win32/win32.h
@@ -19,9 +19,7 @@
//
// #include <stdarg.h> conflict with varargs.h?
-// There is function-name conflitct, so we rename it
#if !defined(IN) && !defined(FLOAT)
-#define OpenFile WINAPI_OpenFile
#ifdef __BORLANDC__
#define USE_WINSOCK2
#endif
@@ -32,7 +30,6 @@
#include <windows.h>
#include <winsock.h>
#endif
-#undef OpenFile
#endif
#define NT 1 /* deprecated */

0 comments on commit 946b981

Please sign in to comment.