From d54f74a48b8b996f9c27077e28d9d24f2c4e4c1d Mon Sep 17 00:00:00 2001 From: "S.H" Date: Sun, 13 Jun 2021 13:44:46 +0900 Subject: [PATCH] Refactor rb_block_call function rb_block_call and rb_block_call_kw have similar code. So, using rb_block_kw function in rb_block_call function for refactoring. --- vm_eval.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/vm_eval.c b/vm_eval.c index e089c0eea2..2fed4007de 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -1579,18 +1579,13 @@ iterate_method(VALUE obj) return rb_call(arg->obj, arg->mid, arg->argc, arg->argv, arg->kw_splat ? CALL_FCALL_KW : CALL_FCALL); } +VALUE rb_block_call_kw(VALUE obj, ID mid, int argc, const VALUE * argv, rb_block_call_func_t bl_proc, VALUE data2, int kw_splat); + VALUE rb_block_call(VALUE obj, ID mid, int argc, const VALUE * argv, rb_block_call_func_t bl_proc, VALUE data2) { - struct iter_method_arg arg; - - arg.obj = obj; - arg.mid = mid; - arg.argc = argc; - arg.argv = argv; - arg.kw_splat = 0; - return rb_iterate(iterate_method, (VALUE)&arg, bl_proc, data2); + return rb_block_call_kw(obj, mid, argc, argv, bl_proc, data2, RB_NO_KEYWORDS); } VALUE