From ae2dc3f217ba9f181471f39a7e5ce72a28b27c2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= Date: Tue, 27 Aug 2019 11:16:52 +0900 Subject: rb_define_hooked_variable now free from ANYARGS After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit uses rb_gvar_getter_t / rb_gvar_setter_t for rb_define_hooked_variable / rb_define_virtual_variable which revealed lots of function prototype inconsistencies. Some of them were literally decades old, going back to dda5dc00cff334cac373096d444a0fd59e716124. --- ruby.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'ruby.c') diff --git a/ruby.c b/ruby.c index 2610cf2387..57c95fa4ae 100644 --- a/ruby.c +++ b/ruby.c @@ -1446,13 +1446,13 @@ VALUE rb_argv0; VALUE rb_e_script; static VALUE -false_value(void) +false_value(ID _x, VALUE *_y) { return Qfalse; } static VALUE -true_value(void) +true_value(ID _x, VALUE *_y) { return Qtrue; } @@ -2230,7 +2230,7 @@ ruby_setproctitle(VALUE title) } static void -set_arg0(VALUE val, ID id) +set_arg0(VALUE val, ID id, VALUE *_) { if (origarg.argv == 0) rb_raise(rb_eRuntimeError, "$0 not initialized"); @@ -2304,16 +2304,14 @@ forbid_setid(const char *s, const ruby_cmdline_options_t *opt) } static void -verbose_setter(VALUE val, ID id, void *data) +verbose_setter(VALUE val, ID id, VALUE *variable) { - VALUE *variable = data; *variable = RTEST(val) ? Qtrue : val; } static VALUE -opt_W_getter(ID id, void *data) +opt_W_getter(ID id, VALUE *variable) { - VALUE *variable = data; switch (*variable) { case Qnil: return INT2FIX(0); -- cgit v1.2.3