summaryrefslogtreecommitdiff
path: root/ext/zlib
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2019-08-26 15:20:15 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2019-08-27 15:52:26 +0900
commit703783324c16b8b2b50210d1a7d1119902abbb8b (patch)
treed594ba9029a1ddcee223fcb2f39be07ef20daca1 /ext/zlib
parent5c7c2d9951f2512ca10ea38fecc48d8ac67502e6 (diff)
rb_ensure now free from ANYARGS
After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit deletes ANYARGS from rb_ensure, which also revealed many arity / type mismatches.
Diffstat (limited to 'ext/zlib')
-rw-r--r--ext/zlib/zlib.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index e84e565932..afd761f1c1 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -85,6 +85,7 @@ static void zstream_passthrough_input(struct zstream*);
static VALUE zstream_detach_input(struct zstream*);
static void zstream_reset(struct zstream*);
static VALUE zstream_end(struct zstream*);
+static VALUE zstream_ensure_end(VALUE v);
static void zstream_run(struct zstream*, Bytef*, long, int);
static VALUE zstream_sync(struct zstream*, Bytef*, long);
static void zstream_mark(void*);
@@ -955,6 +956,12 @@ zstream_end(struct zstream *z)
return Qnil;
}
+static VALUE
+zstream_ensure_end(VALUE v)
+{
+ return zstream_end((struct zstream *)v);
+}
+
static void *
zstream_run_func(void *ptr)
{
@@ -1640,7 +1647,7 @@ rb_deflate_s_deflate(int argc, VALUE *argv, VALUE klass)
args[0] = (VALUE)&z;
args[1] = src;
- dst = rb_ensure(deflate_run, (VALUE)args, zstream_end, (VALUE)&z);
+ dst = rb_ensure(deflate_run, (VALUE)args, zstream_ensure_end, (VALUE)&z);
OBJ_INFECT(dst, src);
return dst;
@@ -1955,7 +1962,7 @@ rb_inflate_s_inflate(VALUE obj, VALUE src)
args[0] = (VALUE)&z;
args[1] = src;
- dst = rb_ensure(inflate_run, (VALUE)args, zstream_end, (VALUE)&z);
+ dst = rb_ensure(inflate_run, (VALUE)args, zstream_ensure_end, (VALUE)&z);
OBJ_INFECT(dst, src);
return dst;
@@ -2919,7 +2926,7 @@ gzfile_writer_end(struct gzfile *gz)
if (ZSTREAM_IS_CLOSING(&gz->z)) return;
gz->z.flags |= ZSTREAM_FLAG_CLOSING;
- rb_ensure(gzfile_writer_end_run, (VALUE)gz, zstream_end, (VALUE)&gz->z);
+ rb_ensure(gzfile_writer_end_run, (VALUE)gz, zstream_ensure_end, (VALUE)&gz->z);
}
static VALUE
@@ -2941,7 +2948,7 @@ gzfile_reader_end(struct gzfile *gz)
if (ZSTREAM_IS_CLOSING(&gz->z)) return;
gz->z.flags |= ZSTREAM_FLAG_CLOSING;
- rb_ensure(gzfile_reader_end_run, (VALUE)gz, zstream_end, (VALUE)&gz->z);
+ rb_ensure(gzfile_reader_end_run, (VALUE)gz, zstream_ensure_end, (VALUE)&gz->z);
}
static void