aboutsummaryrefslogtreecommitdiffstats
path: root/proc.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2019-08-26 15:35:28 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2019-08-27 15:52:26 +0900
commitbc3e7924bc66d3ef77b219c72f3e59cc154550a3 (patch)
tree44aed5a94d9d16dee2af0f92ed4653d6e2deb198 /proc.c
parentaf5e2566405e4808a6d0a29c5b7d305d6fc0aada (diff)
downloadruby-bc3e7924bc66d3ef77b219c72f3e59cc154550a3.tar.gz
rb_proc_new / rb_fiber_new now free from ANYARGS
After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit deletes ANYARGS from rb_proc_new / rb_fiber_new, and applies RB_BLOCK_CALL_FUNC_ARGLIST wherever necessary.
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/proc.c b/proc.c
index 1c0a5dfcd9..1b8aa3953b 100644
--- a/proc.c
+++ b/proc.c
@@ -2790,7 +2790,7 @@ bmcall(RB_BLOCK_CALL_FUNC_ARGLIST(args, method))
VALUE
rb_proc_new(
- VALUE (*func)(ANYARGS), /* VALUE yieldarg[, VALUE procarg] */
+ rb_block_call_func_t func,
VALUE val)
{
VALUE procval = rb_iterate(mproc, 0, func, val);
@@ -2987,7 +2987,7 @@ proc_binding(VALUE self)
return bindval;
}
-static VALUE curry(VALUE dummy, VALUE args, int argc, VALUE *argv, VALUE passed_proc);
+static rb_block_call_func curry;
static VALUE
make_curry_proc(VALUE proc, VALUE passed, VALUE arity)
@@ -3007,7 +3007,7 @@ make_curry_proc(VALUE proc, VALUE passed, VALUE arity)
}
static VALUE
-curry(VALUE dummy, VALUE args, int argc, VALUE *argv, VALUE passed_proc)
+curry(RB_BLOCK_CALL_FUNC_ARGLIST(_, args))
{
VALUE proc, passed, arity;
proc = RARRAY_AREF(args, 0);
@@ -3018,14 +3018,14 @@ curry(VALUE dummy, VALUE args, int argc, VALUE *argv, VALUE passed_proc)
rb_ary_freeze(passed);
if (RARRAY_LEN(passed) < FIX2INT(arity)) {
- if (!NIL_P(passed_proc)) {
+ if (!NIL_P(blockarg)) {
rb_warn("given block not used");
}
arity = make_curry_proc(proc, passed, arity);
return arity;
}
else {
- return rb_proc_call_with_block(proc, check_argc(RARRAY_LEN(passed)), RARRAY_CONST_PTR(passed), passed_proc);
+ return rb_proc_call_with_block(proc, check_argc(RARRAY_LEN(passed)), RARRAY_CONST_PTR(passed), blockarg);
}
}
@@ -3130,16 +3130,16 @@ rb_method_curry(int argc, const VALUE *argv, VALUE self)
}
static VALUE
-compose(VALUE dummy, VALUE args, int argc, VALUE *argv, VALUE passed_proc)
+compose(RB_BLOCK_CALL_FUNC_ARGLIST(_, args))
{
VALUE f, g, fargs;
f = RARRAY_AREF(args, 0);
g = RARRAY_AREF(args, 1);
if (rb_obj_is_proc(g))
- fargs = rb_proc_call_with_block(g, argc, argv, passed_proc);
+ fargs = rb_proc_call_with_block(g, argc, argv, blockarg);
else
- fargs = rb_funcall_with_block(g, idCall, argc, argv, passed_proc);
+ fargs = rb_funcall_with_block(g, idCall, argc, argv, blockarg);
if (rb_obj_is_proc(f))
return rb_proc_call(f, rb_ary_new3(1, fargs));