aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-04 15:03:37 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-04 15:03:37 +0000
commit503e0d15703c150d7e1e9c4a10b4e46ceee7bb2c (patch)
tree0ff882124c58f8de066cbfc4da456f831a3056ac /io.c
parent7a2246ee38e4f57583e4427a4529bafb4ea36c31 (diff)
downloadruby-503e0d15703c150d7e1e9c4a10b4e46ceee7bb2c.tar.gz
nobody is using the return value of rb_io_fptr_finalize
However this function is listed in ruby/io.h. We cannot but define a new, void-returning variant to use instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/io.c b/io.c
index 56332fe929..e5f3aef95d 100644
--- a/io.c
+++ b/io.c
@@ -4629,21 +4629,36 @@ clear_codeconv(rb_io_t *fptr)
clear_writeconv(fptr);
}
-int
-rb_io_fptr_finalize(rb_io_t *fptr)
+void
+rb_io_fptr_finalize_internal(void *ptr)
{
- if (!fptr) return 0;
+ rb_io_t *fptr = ptr;
+
+ if (!ptr) return;
fptr->pathv = Qnil;
if (0 <= fptr->fd)
- rb_io_fptr_cleanup(fptr, TRUE);
+ rb_io_fptr_cleanup(fptr, TRUE);
fptr->write_lock = 0;
free_io_buffer(&fptr->rbuf);
free_io_buffer(&fptr->wbuf);
clear_codeconv(fptr);
free(fptr);
- return 1;
}
+#undef rb_io_fptr_finalize
+int
+rb_io_fptr_finalize(rb_io_t *fptr)
+{
+ if (!fptr) {
+ return 0;
+ }
+ else {
+ rb_io_fptr_finalize_internal(fptr);
+ return 1;
+ }
+}
+#define rb_io_fptr_finalize(fptr) rb_io_fptr_finalize_internal(fptr)
+
RUBY_FUNC_EXPORTED size_t
rb_io_memsize(const rb_io_t *fptr)
{