From 78f7b7036bb6c950a3533a5eb0f2fc9741511efa Mon Sep 17 00:00:00 2001 From: akr Date: Wed, 8 Dec 2004 13:26:27 +0000 Subject: * rubyio.h, io.c, ext/dl/dl.c, ext/pty/pty.c, ext/socket/socket.c: create FILE object only when required: popen(3) and DL's IO#to_ptr. [ruby-dev:25122] * io.c (rb_io_binmode): use setmode for Human68k. [ruby-dev:25121] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/dl/dl.c | 2 +- ext/pty/pty.c | 2 -- ext/socket/socket.c | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) (limited to 'ext') diff --git a/ext/dl/dl.c b/ext/dl/dl.c index 1469ff82a7..d92347158f 100644 --- a/ext/dl/dl.c +++ b/ext/dl/dl.c @@ -542,7 +542,7 @@ rb_io_to_ptr(VALUE self) FILE *fp; GetOpenFile(self, fptr); - fp = fptr->f; + fp = rb_io_stdio_file(fptr); return fp ? rb_dlptr_new(fp, sizeof(FILE), 0) : Qnil; } diff --git a/ext/pty/pty.c b/ext/pty/pty.c index d47acbe5b5..8e9e63036c 100644 --- a/ext/pty/pty.c +++ b/ext/pty/pty.c @@ -428,12 +428,10 @@ pty_getpty(argc, argv, self) rfptr->mode = rb_io_mode_flags("r"); rfptr->fd = info.fd; - rfptr->f = rb_fdopen(info.fd, "r"); rfptr->path = strdup(SlaveName); wfptr->mode = rb_io_mode_flags("w") | FMODE_SYNC; wfptr->fd = dup(info.fd); - wfptr->f = rb_fdopen(wfptr->fd, "w"); wfptr->path = strdup(SlaveName); res = rb_ary_new2(3); diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 9f8e747841..83a70b203d 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -183,7 +183,6 @@ init_sock(sock, fd) MakeOpenFile(sock, fp); fp->fd = fd; - fp->f = rb_fdopen(fd, "r+"); fp->mode = FMODE_READWRITE; if (do_not_reverse_lookup) { fp->mode |= FMODE_NOREVLOOKUP; -- cgit v1.2.3