ruby-changes:43700
From: nobu <ko1@a...>
Date: Fri, 29 Jul 2016 20:57:22 +0900 (JST)
Subject: [ruby-changes:43700] nobu:r55773 (trunk): rb_funcallv
nobu 2016-07-29 20:57:14 +0900 (Fri, 29 Jul 2016) New Revision: 55773 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55773 Log: rb_funcallv * *.c: rename rb_funcall2 to rb_funcallv, except for extensions which are/will be/may be gems. [Fix GH-1406] Modified files: trunk/ChangeLog trunk/complex.c trunk/dir.c trunk/enumerator.c trunk/eval.c trunk/ext/-test-/funcall/passing_block.c trunk/ext/-test-/notimplement/bug.c trunk/ext/digest/bubblebabble/bubblebabble.c trunk/ext/digest/digest.c trunk/ext/pathname/pathname.c trunk/ext/socket/unixsocket.c trunk/ext/win32ole/win32ole.c trunk/hash.c trunk/io.c trunk/iseq.c trunk/random.c trunk/rational.c trunk/ruby.c trunk/string.c trunk/thread_sync.c trunk/vm_eval.c trunk/vm_insnhelper.c trunk/vm_method.c Index: string.c =================================================================== --- string.c (revision 55772) +++ string.c (revision 55773) @@ -3526,7 +3526,7 @@ rb_str_match_m(int argc, VALUE *argv, VA https://github.com/ruby/ruby/blob/trunk/string.c#L3526 rb_check_arity(argc, 1, 2); re = argv[0]; argv[0] = str; - result = rb_funcall2(get_pat(re), rb_intern("match"), argc, argv); + result = rb_funcallv(get_pat(re), rb_intern("match"), argc, argv); if (!NIL_P(result) && rb_block_given_p()) { return rb_yield(result); } Index: io.c =================================================================== --- io.c (revision 55772) +++ io.c (revision 55773) @@ -6606,7 +6606,7 @@ rb_f_open(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/io.c#L6606 } } if (redirect) { - VALUE io = rb_funcall2(argv[0], to_open, argc-1, argv+1); + VALUE io = rb_funcallv(argv[0], to_open, argc-1, argv+1); if (rb_block_given_p()) { return rb_ensure(rb_yield, io, io_close, io); @@ -7079,7 +7079,7 @@ rb_f_putc(VALUE recv, VALUE ch) https://github.com/ruby/ruby/blob/trunk/io.c#L7079 if (recv == rb_stdout) { return rb_io_putc(recv, ch); } - return rb_funcall2(rb_stdout, rb_intern("putc"), 1, &ch); + return rb_funcallv(rb_stdout, rb_intern("putc"), 1, &ch); } @@ -7184,7 +7184,7 @@ rb_f_puts(int argc, VALUE *argv, VALUE r https://github.com/ruby/ruby/blob/trunk/io.c#L7184 if (recv == rb_stdout) { return rb_io_puts(argc, argv, recv); } - return rb_funcall2(rb_stdout, rb_intern("puts"), argc, argv); + return rb_funcallv(rb_stdout, rb_intern("puts"), argc, argv); } void @@ -8206,7 +8206,7 @@ rb_f_gets(int argc, VALUE *argv, VALUE r https://github.com/ruby/ruby/blob/trunk/io.c#L8206 if (recv == argf) { return argf_gets(argc, argv, argf); } - return rb_funcall2(argf, idGets, argc, argv); + return rb_funcallv(argf, idGets, argc, argv); } /* @@ -8279,7 +8279,7 @@ rb_f_readline(int argc, VALUE *argv, VAL https://github.com/ruby/ruby/blob/trunk/io.c#L8279 if (recv == argf) { return argf_readline(argc, argv, argf); } - return rb_funcall2(argf, rb_intern("readline"), argc, argv); + return rb_funcallv(argf, rb_intern("readline"), argc, argv); } @@ -8332,7 +8332,7 @@ rb_f_readlines(int argc, VALUE *argv, VA https://github.com/ruby/ruby/blob/trunk/io.c#L8332 if (recv == argf) { return argf_readlines(argc, argv, argf); } - return rb_funcall2(argf, rb_intern("readlines"), argc, argv); + return rb_funcallv(argf, rb_intern("readlines"), argc, argv); } /* @@ -10864,7 +10864,7 @@ rb_io_set_encoding(int argc, VALUE *argv https://github.com/ruby/ruby/blob/trunk/io.c#L10864 VALUE v1, v2, opt; if (!RB_TYPE_P(io, T_FILE)) { - return rb_funcall2(io, id_set_encoding, argc, argv); + return rb_funcallv(io, id_set_encoding, argc, argv); } argc = rb_scan_args(argc, argv, "11:", &v1, &v2, &opt); Index: ruby.c =================================================================== --- ruby.c (revision 55772) +++ ruby.c (revision 55773) @@ -634,7 +634,7 @@ require_libraries(VALUE *req_list) https://github.com/ruby/ruby/blob/trunk/ruby.c#L634 rb_enc_associate(feature, extenc); RBASIC_SET_CLASS_RAW(feature, rb_cString); OBJ_FREEZE(feature); - rb_funcall2(self, require, 1, &feature); + rb_funcallv(self, require, 1, &feature); } *req_list = 0; } Index: rational.c =================================================================== --- rational.c (revision 55772) +++ rational.c (revision 55773) @@ -605,7 +605,7 @@ f_rational_new_no_reduce2(VALUE klass, V https://github.com/ruby/ruby/blob/trunk/rational.c#L605 static VALUE nurat_f_rational(int argc, VALUE *argv, VALUE klass) { - return rb_funcall2(rb_cRational, id_convert, argc, argv); + return rb_funcallv(rb_cRational, id_convert, argc, argv); } /* Index: vm_method.c =================================================================== --- vm_method.c (revision 55772) +++ vm_method.c (revision 55773) @@ -610,7 +610,7 @@ rb_method_entry_make(VALUE klass, ID mid https://github.com/ruby/ruby/blob/trunk/vm_method.c#L610 recv_class = rb_ivar_get((klass), attached); \ hook_id = singleton_##hook; \ } \ - rb_funcall2(recv_class, hook_id, 1, &arg); \ + rb_funcallv(recv_class, hook_id, 1, &arg); \ } while (0) static void Index: iseq.c =================================================================== --- iseq.c (revision 55772) +++ iseq.c (revision 55773) @@ -325,7 +325,7 @@ cleanup_iseq_build(rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/iseq.c#L325 compile_data_free(data); if (RTEST(err)) { - rb_funcall2(err, rb_intern("set_backtrace"), 1, &iseq->body->location.path); + rb_funcallv(err, rb_intern("set_backtrace"), 1, &iseq->body->location.path); rb_exc_raise(err); } return Qtrue; Index: complex.c =================================================================== --- complex.c (revision 55772) +++ complex.c (revision 55773) @@ -468,7 +468,7 @@ f_complex_new2(VALUE klass, VALUE x, VAL https://github.com/ruby/ruby/blob/trunk/complex.c#L468 static VALUE nucomp_f_complex(int argc, VALUE *argv, VALUE klass) { - return rb_funcall2(rb_cComplex, id_convert, argc, argv); + return rb_funcallv(rb_cComplex, id_convert, argc, argv); } #define imp1(n) \ @@ -1582,7 +1582,7 @@ nucomp_rationalize(int argc, VALUE *argv https://github.com/ruby/ruby/blob/trunk/complex.c#L1582 rb_raise(rb_eRangeError, "can't convert %"PRIsVALUE" into Rational", self); } - return rb_funcall2(dat->real, rb_intern("rationalize"), argc, argv); + return rb_funcallv(dat->real, rb_intern("rationalize"), argc, argv); } /* Index: ext/pathname/pathname.c =================================================================== --- ext/pathname/pathname.c (revision 55772) +++ ext/pathname/pathname.c (revision 55773) @@ -202,7 +202,7 @@ path_sub(int argc, VALUE *argv, VALUE se https://github.com/ruby/ruby/blob/trunk/ext/pathname/pathname.c#L202 str = rb_block_call(str, rb_intern("sub"), argc, argv, 0, 0); } else { - str = rb_funcall2(str, rb_intern("sub"), argc, argv); + str = rb_funcallv(str, rb_intern("sub"), argc, argv); } return rb_class_new_instance(1, &str, rb_obj_class(self)); } @@ -299,7 +299,7 @@ path_each_line(int argc, VALUE *argv, VA https://github.com/ruby/ruby/blob/trunk/ext/pathname/pathname.c#L299 return rb_block_call(rb_cIO, rb_intern("foreach"), 1+n, args, 0, 0); } else { - return rb_funcall2(rb_cIO, rb_intern("foreach"), 1+n, args); + return rb_funcallv(rb_cIO, rb_intern("foreach"), 1+n, args); } } @@ -321,7 +321,7 @@ path_read(int argc, VALUE *argv, VALUE s https://github.com/ruby/ruby/blob/trunk/ext/pathname/pathname.c#L321 args[0] = get_strpath(self); n = rb_scan_args(argc, argv, "03", &args[1], &args[2], &args[3]); - return rb_funcall2(rb_cIO, rb_intern("read"), 1+n, args); + return rb_funcallv(rb_cIO, rb_intern("read"), 1+n, args); } /* @@ -341,7 +341,7 @@ path_binread(int argc, VALUE *argv, VALU https://github.com/ruby/ruby/blob/trunk/ext/pathname/pathname.c#L341 args[0] = get_strpath(self); n = rb_scan_args(argc, argv, "02", &args[1], &args[2]); - return rb_funcall2(rb_cIO, rb_intern("binread"), 1+n, args); + return rb_funcallv(rb_cIO, rb_intern("binread"), 1+n, args); } /* @@ -362,7 +362,7 @@ path_write(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/ext/pathname/pathname.c#L362 args[0] = get_strpath(self); n = rb_scan_args(argc, argv, "03", &args[1], &args[2], &args[3]); - return rb_funcall2(rb_cIO, rb_intern("write"), 1+n, args); + return rb_funcallv(rb_cIO, rb_intern("write"), 1+n, args); } /* @@ -383,7 +383,7 @@ path_binwrite(int argc, VALUE *argv, VAL https://github.com/ruby/ruby/blob/trunk/ext/pathname/pathname.c#L383 args[0] = get_strpath(self); n = rb_scan_args(argc, argv, "03", &args[1], &args[2], &args[3]); - return rb_funcall2(rb_cIO, rb_intern("binwrite"), 1+n, args); + return rb_funcallv(rb_cIO, rb_intern("binwrite"), 1+n, args); } /* @@ -405,7 +405,7 @@ path_readlines(int argc, VALUE *argv, VA https://github.com/ruby/ruby/blob/trunk/ext/pathname/pathname.c#L405 args[0] = get_strpath(self); n = rb_scan_args(argc, argv, "03", &args[1], &args[2], &args[3]); - return rb_funcall2(rb_cIO, rb_intern("readlines"), 1+n, args); + return rb_funcallv(rb_cIO, rb_intern("readlines"), 1+n, args); } /* @@ -423,7 +423,7 @@ path_sysopen(int argc, VALUE *argv, VALU https://github.com/ruby/ruby/blob/trunk/ext/pathname/pathname.c#L423 args[0] = get_strpath(self); n = rb_scan_args(argc, argv, "02", &args[1], &args[2]); - return rb_funcall2(rb_cIO, rb_intern("sysopen"), 1+n, args); + return rb_funcallv(rb_cIO, rb_intern("sysopen"), 1+n, args); } /* @@ -608,7 +608,7 @@ path_open(int argc, VALUE *argv, VALUE s https://github.com/ruby/ruby/blob/trunk/ext/pathname/pathname.c#L608 return rb_block_call(rb_cFile, rb_intern("open"), 1+n, args, 0, 0); } else { - return rb_funcall2(rb_cFile, rb_intern("open"), 1+n, args); + return rb_funcallv(rb_cFile, rb_intern("open"), 1+n, args); } } @@ -1013,7 +1013,7 @@ path_s_glob(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/ext/pathname/pathname.c#L1013 else { VALUE ary; long i; - ary = rb_funcall2(rb_cDir, rb_intern("glob"), n, args); + ary = rb_funcallv(rb_cDir, rb_intern("glob"), n, args); ary = rb_convert_type(ary, T_ARRAY, "Array", "to_ary"); for (i = 0; i < RARRAY_LEN(ary); i++) { VALUE elt = RARRAY_AREF(ary, i); Index: ext/digest/digest.c =================================================================== --- ext/digest/digest.c (revision 55772) +++ ext/digest/digest.c (revision 55773) @@ -486,7 +486,7 @@ rb_digest_class_s_digest(int argc, VALUE https://github.com/ruby/ruby/blob/trunk/ext/digest/digest.c#L486 static VALUE rb_digest_class_s_hexdigest(int argc, VALUE *argv, VALUE klass) { - return hexencode_str_new(rb_funcall2(klass, id_digest, argc, argv)); + return hexencode_str_new(rb_funcallv(klass, id_digest, argc, argv)); } /* :nodoc: */ Index: ext/digest/bubblebabble/bubblebabble.c =================================================================== --- ext/digest/bubblebabble/bubblebabble.c (revision 55772) +++ ext/digest/bubblebabble/bubblebabble.c (revision 55773) @@ -101,7 +101,7 @@ rb_digest_s_bubblebabble(VALUE klass, VA https://github.com/ruby/ruby/blob/trunk/ext/digest/bubblebabble/bubblebabble.c#L101 static VALUE rb_digest_class_s_bubblebabble(int argc, VALUE *argv, VALUE klass) { - return bubblebabble_str_new(rb_funcall2(klass, id_digest, argc, argv)); + return bubblebabble_str_new(rb_funcallv(klass, id_digest, argc, argv)); } /* Document-method: Digest::Instance#bubblebabble Index: ext/win32ole/win32ole.c =================================================================== --- ext/win32ole/win32ole.c (revision 55772) +++ ext/win32ole/win32ole.c (revision 55773) @@ -383,7 +383,7 @@ static /* [local] */ HRESULT ( STDMETHOD https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L383 mid = rb_intern("value"); } } - v = rb_funcall2(p->obj, mid, args, parg); + v = rb_funcallv(p->obj, mid, args, parg); ole_val2variant(v, pVarResult); return S_OK; } Index: ext/-test-/notimplement/bug.c =================================================================== --- ext/-test-/notimplement/bug.c (revision 55772) +++ ext/-test-/notimplement/bug.c (revision 55773) @@ -4,7 +4,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/ext/-test-/notimplement/bug.c#L4 bug_funcall(int argc, VALUE *argv, VALUE self) { if (argc < 1) rb_raise(rb_eArgError, "not enough argument"); - return rb_funcall2(self, rb_to_id(*argv), argc-1, argv+1); + return rb_funcallv(self, rb_to_id(*argv), argc-1, argv+1); } void Index: ext/-test-/funcall/passing_block.c =================================================================== --- ext/-test-/funcall/passing_block.c (revision 55772) +++ ext/-test-/funcall/passing_block.c (revision 55773) @@ -5,7 +5,7 @@ VALUE rb_funcall_passing_block(VALUE, ID https://github.com/ruby/ruby/blob/trunk/ext/-test-/funcall/passing_block.c#L5 static VALUE with_funcall2(int argc, VALUE *argv, VALUE self) { - return rb_funcall2(self, rb_intern("target"), argc, argv); + return rb_funcallv(self, rb_intern("target"), argc, argv); } static VALUE Index: ext/socket/unixsocket.c =================================================================== --- ext/socket/unixsocket.c (revision 55772) +++ ext/socket/unixsocket.c (revision 55773) @@ -422,7 +422,7 @@ unix_recv_io(int argc, VALUE *argv, VALU https://github.com/ruby/ruby/blob/trunk/ext/socket/unixsocket.c#L422 ff_argc = mode == Qnil ? 1 : 2; ff_argv[0] = INT2FIX(fd); ff_argv[1] = mode; - return rb_funcall2(klass, for_fd, ff_argc, ff_argv); + return rb_funcallv(klass, for_fd, ff_argc, ff_argv); } } #else Index: thread_sync.c =================================================================== --- thread_sync.c (revision 55772) +++ thread_sync.c (revision 55773) @@ -1157,7 +1157,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/thread_sync.c#L1157 do_sleep(VALUE args) { struct sleep_call *p = (struct sleep_call *)args; - return rb_funcall2(p->mutex, id_sleep, 1, &p->timeout); + return rb_funcallv(p->mutex, id_sleep, 1, &p->timeout); } static VALUE Index: ChangeLog =================================================================== --- ChangeLog (revision 55772) +++ ChangeLog (revision 55773) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Jul 29 20:57:12 2016 chuanshuo <lilijreey@1...> + + * *.c: rename rb_funcall2 to rb_funcallv, except for extensions + which are/will be/may be gems. [Fix GH-1406] + Fri Jul 29 10:51:34 2016 Koichi Sasada <ko1@a...> * proc.c (env_write): remove unused function. Index: random.c =================================================================== --- random.c (revision 55772) +++ random.c (revision 55773) @@ -957,7 +957,7 @@ rb_random_real(VALUE obj) https://github.com/ruby/ruby/blob/trunk/random.c#L957 { rb_random_t *rnd = try_get_rnd(obj); if (!rnd) { - VALUE v = rb_funcall2(obj, id_rand, 0, 0); + VALUE v = rb_funcallv(obj, id_rand, 0, 0); double d = NUM2DBL(v); if (d < 0.0) { rb_raise(rb_eRangeError, "random number too small %g", d); @@ -1018,7 +1018,7 @@ rb_random_ulong_limited(VALUE obj, unsig https://github.com/ruby/ruby/blob/trunk/random.c#L1018 rb_random_t *rnd = try_get_rnd(obj); if (!rnd) { VALUE lim = ulong_to_num_plus_1(limit); - VALUE v = rb_to_int(rb_funcall2(obj, id_rand, 1, &lim)); + VALUE v = rb_to_int(rb_funcallv(obj, id_rand, 1, &lim)); unsigned long r = NUM2ULONG(v); if (rb_num_negative_p(v)) { rb_raise(rb_eRangeError, "random number too small %ld", r); @@ -1121,7 +1121,7 @@ range_values(VALUE vmax, VALUE *begp, VA https://github.com/ruby/ruby/blob/trunk/random.c#L1121 if (!rb_range_values(vmax, begp, &end, exclp)) return Qfalse; if (endp) *endp = end; if (!rb_respond_to(end, id_minus)) return Qfalse; - r = rb_funcall2(end, id_minus, 1, begp); + r = rb_funcallv(end, id_minus, 1, begp); if (NIL_P(r)) return Qfalse; return r; } @@ -1270,7 +1270,7 @@ rand_range(VALUE obj, rb_random_t* rnd, https://github.com/ruby/ruby/blob/trunk/random.c#L1270 } } default: - return rb_funcall2(beg, id_plus, 1, &v); + return rb_funcallv(beg, id_plus, 1, &v); } return v; Index: eval.c =================================================================== --- eval.c (revision 55772) +++ eval.c (revision 55773) @@ -1315,7 +1315,7 @@ void https://github.com/ruby/ruby/blob/trunk/eval.c#L1315 rb_obj_call_init(VALUE obj, int argc, const VALUE *argv) { PASS_PASSED_BLOCK_HANDLER(); - rb_funcall2(obj, idInitialize, argc, argv); + rb_funcallv(obj, idInitialize, argc, argv); } void Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 55772) +++ vm_insnhelper.c (revision 55773) @@ -1303,7 +1303,7 @@ check_match(VALUE pattern, VALUE target, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1303 } else { /* fallback to funcall (e.g. method_missing) */ - return rb_funcall2(pattern, idEqq, 1, &target); + return rb_funcallv(pattern, idEqq, 1, &target); } } default: Index: hash.c =================================================================== --- hash.c (revision 55772) +++ hash.c (revision 55773) @@ -2588,10 +2588,10 @@ rb_hash_flatten(int argc, VALUE *argv, V https://github.com/ruby/ruby/blob/trunk/hash.c#L2588 rb_hash_foreach(hash, flatten_i, ary); if (level - 1 > 0) { *argv = INT2FIX(level - 1); - rb_funcall2(ary, id_flatten_bang, argc, argv); + rb_funcallv(ary, id_flatten_bang, argc, argv); } else if (level < 0) { - rb_funcall2(ary, id_flatten_bang, 0, 0); + rb_funcallv(ary, id_flatten_bang, 0, 0); } } else { Index: vm_eval.c =================================================================== --- vm_eval.c (revision 55772) +++ vm_eval.c (revision 55773) @@ -853,7 +853,7 @@ rb_funcallv(VALUE recv, ID mid, int argc https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L853 /*! * Calls a method. * - * Same as rb_funcall2 but this function can call only public methods. + * Same as rb_funcallv but this function can call only public methods. * \param recv receiver of the method * \param mid an ID that represents the name of the method * \param argc the number of arguments @@ -1543,7 +1543,7 @@ rb_eval_cmd(VALUE cmd, VALUE arg, int le https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1543 rb_set_safe_level_force(level); if ((state = TH_EXEC_TAG()) == 0) { if (!RB_TYPE_P(cmd, T_STRING)) { - val = rb_funcall2(cmd, idCall, RARRAY_LENINT(arg), + val = rb_funcallv(cmd, idCall, RARRAY_LENINT(arg), RARRAY_CONST_PTR(arg)); } else { Index: dir.c =================================================================== --- dir.c (revision 55772) +++ dir.c (revision 55773) @@ -2364,7 +2364,7 @@ dir_s_glob(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/dir.c#L2364 static VALUE dir_open_dir(int argc, VALUE *argv) { - VALUE dir = rb_funcall2(rb_cDir, rb_intern("open"), argc, argv); + VALUE dir = rb_funcallv(rb_cDir, rb_intern("open"), argc, argv); rb_check_typeddata(dir, &dir_data_type); return dir; Index: enumerator.c =================================================================== --- enumerator.c (revision 55772) +++ enumerator.c (revision 55773) @@ -1528,7 +1528,7 @@ lazy_map(VALUE obj) https://github.com/ruby/ruby/blob/trunk/enumerator.c#L1528 static VALUE lazy_flat_map_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, yielder)) { - return rb_funcall2(yielder, id_yield, argc, argv); + return rb_funcallv(yielder, id_yield, argc, argv); } static VALUE @@ -1830,7 +1830,7 @@ lazy_take_func(RB_BLOCK_CALL_FUNC_ARGLIS https://github.com/ruby/ruby/blob/trunk/enumerator.c#L1830 memo = args; } - rb_funcall2(argv[0], id_yield, argc - 1, argv + 1); + rb_funcallv(argv[0], id_yield, argc - 1, argv + 1); if ((remain = NUM2LONG(memo)-1) == 0) { return Qundef; } @@ -1875,7 +1875,7 @@ lazy_take_while_func(RB_BLOCK_CALL_FUNC_ https://github.com/ruby/ruby/blob/trunk/enumerator.c#L1875 { VALUE result = rb_yield_values2(argc - 1, &argv[1]); if (!RTEST(result)) return Qundef; - rb_funcall2(argv[0], id_yield, argc - 1, a (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/