From a08b97c2f6c5ef85a3d8eee0eaf73015612316b5 Mon Sep 17 00:00:00 2001 From: akr Date: Wed, 27 Aug 2008 17:19:19 +0000 Subject: [PATCH] * include/ruby/io.h (rb_io_t): refcnt field removed. (MakeOpenFile): refcnt initialization removed. * io.c (rb_io_fptr_finalize): don't check refcnt. (rb_io_close_read): don't use refcnt. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ include/ruby/io.h | 2 -- io.c | 9 +++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 891b992471..6029ab20e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu Aug 28 02:16:49 2008 Tanaka Akira + + * include/ruby/io.h (rb_io_t): refcnt field removed. + (MakeOpenFile): refcnt initialization removed. + + * io.c (rb_io_fptr_finalize): don't check refcnt. + (rb_io_close_read): don't use refcnt. + Thu Aug 28 00:07:59 2008 Tanaka Akira * io.c (rb_io_initialize): don't accept IO object. [ruby-dev:35895] diff --git a/include/ruby/io.h b/include/ruby/io.h index 9ef0c5a7d1..cb2df584d1 100644 --- a/include/ruby/io.h +++ b/include/ruby/io.h @@ -35,7 +35,6 @@ typedef struct rb_io_t { int lineno; /* number of lines read */ VALUE pathv; /* pathname for file */ void (*finalize)(struct rb_io_t*,int); /* finalize proc */ - long refcnt; char *wbuf; /* wbuf_off + wbuf_len <= wbuf_capa */ int wbuf_off; @@ -109,7 +108,6 @@ typedef struct rb_io_t { fp->lineno = 0;\ fp->pathv = Qnil;\ fp->finalize = 0;\ - fp->refcnt = 1;\ fp->wbuf = NULL;\ fp->wbuf_off = 0;\ fp->wbuf_len = 0;\ diff --git a/io.c b/io.c index 08a4e4e859..645df164cb 100644 --- a/io.c +++ b/io.c @@ -3105,7 +3105,6 @@ int rb_io_fptr_finalize(rb_io_t *fptr) { if (!fptr) return 0; - if (fptr->refcnt <= 0 || --fptr->refcnt) return 0; fptr->pathv = Qnil; if (0 <= fptr->fd) rb_io_fptr_cleanup(fptr, Qtrue); @@ -3275,11 +3274,9 @@ rb_io_close_read(VALUE io) rb_io_t *wfptr; fptr_finalize(fptr, Qfalse); GetOpenFile(write_io, wfptr); - if (fptr->refcnt < LONG_MAX) { - wfptr->refcnt++; - RFILE(io)->fptr = wfptr; - rb_io_fptr_finalize(fptr); - } + RFILE(io)->fptr = wfptr; + RFILE(write_io)->fptr = NULL; + rb_io_fptr_finalize(fptr); return Qnil; }