rb_funcallv
* *.c: rename rb_funcall2 to rb_funcallv, except for extensions which are/will be/may be gems. [Fix GH-1406] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
26de0b131e
commit
c463366dfd
@ -1,3 +1,8 @@
|
|||||||
|
Fri Jul 29 20:57:12 2016 chuanshuo <lilijreey@126.com>
|
||||||
|
|
||||||
|
* *.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@atdot.net>
|
Fri Jul 29 10:51:34 2016 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* proc.c (env_write): remove unused function.
|
* proc.c (env_write): remove unused function.
|
||||||
|
@ -468,7 +468,7 @@ f_complex_new2(VALUE klass, VALUE x, VALUE y)
|
|||||||
static VALUE
|
static VALUE
|
||||||
nucomp_f_complex(int argc, VALUE *argv, VALUE klass)
|
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) \
|
#define imp1(n) \
|
||||||
@ -1582,7 +1582,7 @@ nucomp_rationalize(int argc, VALUE *argv, VALUE self)
|
|||||||
rb_raise(rb_eRangeError, "can't convert %"PRIsVALUE" into Rational",
|
rb_raise(rb_eRangeError, "can't convert %"PRIsVALUE" into Rational",
|
||||||
self);
|
self);
|
||||||
}
|
}
|
||||||
return rb_funcall2(dat->real, rb_intern("rationalize"), argc, argv);
|
return rb_funcallv(dat->real, rb_intern("rationalize"), argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
2
dir.c
2
dir.c
@ -2364,7 +2364,7 @@ dir_s_glob(int argc, VALUE *argv, VALUE obj)
|
|||||||
static VALUE
|
static VALUE
|
||||||
dir_open_dir(int argc, VALUE *argv)
|
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);
|
rb_check_typeddata(dir, &dir_data_type);
|
||||||
return dir;
|
return dir;
|
||||||
|
12
enumerator.c
12
enumerator.c
@ -1528,7 +1528,7 @@ lazy_map(VALUE obj)
|
|||||||
static VALUE
|
static VALUE
|
||||||
lazy_flat_map_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, yielder))
|
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
|
static VALUE
|
||||||
@ -1830,7 +1830,7 @@ lazy_take_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, args))
|
|||||||
memo = args;
|
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) {
|
if ((remain = NUM2LONG(memo)-1) == 0) {
|
||||||
return Qundef;
|
return Qundef;
|
||||||
}
|
}
|
||||||
@ -1875,7 +1875,7 @@ lazy_take_while_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, args))
|
|||||||
{
|
{
|
||||||
VALUE result = rb_yield_values2(argc - 1, &argv[1]);
|
VALUE result = rb_yield_values2(argc - 1, &argv[1]);
|
||||||
if (!RTEST(result)) return Qundef;
|
if (!RTEST(result)) return Qundef;
|
||||||
rb_funcall2(argv[0], id_yield, argc - 1, argv + 1);
|
rb_funcallv(argv[0], id_yield, argc - 1, argv + 1);
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1913,7 +1913,7 @@ lazy_drop_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, args))
|
|||||||
memo = args;
|
memo = args;
|
||||||
}
|
}
|
||||||
if ((remain = NUM2LONG(memo)) == 0) {
|
if ((remain = NUM2LONG(memo)) == 0) {
|
||||||
rb_funcall2(argv[0], id_yield, argc - 1, argv + 1);
|
rb_funcallv(argv[0], id_yield, argc - 1, argv + 1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_ivar_set(argv[0], id_memo, LONG2NUM(--remain));
|
rb_ivar_set(argv[0], id_memo, LONG2NUM(--remain));
|
||||||
@ -1942,7 +1942,7 @@ lazy_drop_while_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, args))
|
|||||||
rb_ivar_set(argv[0], id_memo, memo = Qtrue);
|
rb_ivar_set(argv[0], id_memo, memo = Qtrue);
|
||||||
}
|
}
|
||||||
if (memo == Qtrue) {
|
if (memo == Qtrue) {
|
||||||
rb_funcall2(argv[0], id_yield, argc - 1, argv + 1);
|
rb_funcallv(argv[0], id_yield, argc - 1, argv + 1);
|
||||||
}
|
}
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
@ -1963,7 +1963,7 @@ lazy_uniq_i(VALUE i, VALUE hash, int argc, const VALUE *argv, VALUE yielder)
|
|||||||
{
|
{
|
||||||
if (rb_hash_add_new_element(hash, i, Qfalse))
|
if (rb_hash_add_new_element(hash, i, Qfalse))
|
||||||
return Qnil;
|
return Qnil;
|
||||||
return rb_funcall2(yielder, id_yield, argc, argv);
|
return rb_funcallv(yielder, id_yield, argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
2
eval.c
2
eval.c
@ -1315,7 +1315,7 @@ void
|
|||||||
rb_obj_call_init(VALUE obj, int argc, const VALUE *argv)
|
rb_obj_call_init(VALUE obj, int argc, const VALUE *argv)
|
||||||
{
|
{
|
||||||
PASS_PASSED_BLOCK_HANDLER();
|
PASS_PASSED_BLOCK_HANDLER();
|
||||||
rb_funcall2(obj, idInitialize, argc, argv);
|
rb_funcallv(obj, idInitialize, argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -5,7 +5,7 @@ VALUE rb_funcall_passing_block(VALUE, ID, int, const VALUE*);
|
|||||||
static VALUE
|
static VALUE
|
||||||
with_funcall2(int argc, VALUE *argv, VALUE self)
|
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
|
static VALUE
|
||||||
|
@ -4,7 +4,7 @@ static VALUE
|
|||||||
bug_funcall(int argc, VALUE *argv, VALUE self)
|
bug_funcall(int argc, VALUE *argv, VALUE self)
|
||||||
{
|
{
|
||||||
if (argc < 1) rb_raise(rb_eArgError, "not enough argument");
|
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
|
void
|
||||||
|
@ -101,7 +101,7 @@ rb_digest_s_bubblebabble(VALUE klass, VALUE str)
|
|||||||
static VALUE
|
static VALUE
|
||||||
rb_digest_class_s_bubblebabble(int argc, VALUE *argv, VALUE klass)
|
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
|
/* Document-method: Digest::Instance#bubblebabble
|
||||||
|
@ -486,7 +486,7 @@ rb_digest_class_s_digest(int argc, VALUE *argv, VALUE klass)
|
|||||||
static VALUE
|
static VALUE
|
||||||
rb_digest_class_s_hexdigest(int argc, VALUE *argv, VALUE klass)
|
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: */
|
/* :nodoc: */
|
||||||
|
@ -202,7 +202,7 @@ path_sub(int argc, VALUE *argv, VALUE self)
|
|||||||
str = rb_block_call(str, rb_intern("sub"), argc, argv, 0, 0);
|
str = rb_block_call(str, rb_intern("sub"), argc, argv, 0, 0);
|
||||||
}
|
}
|
||||||
else {
|
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));
|
return rb_class_new_instance(1, &str, rb_obj_class(self));
|
||||||
}
|
}
|
||||||
@ -299,7 +299,7 @@ path_each_line(int argc, VALUE *argv, VALUE self)
|
|||||||
return rb_block_call(rb_cIO, rb_intern("foreach"), 1+n, args, 0, 0);
|
return rb_block_call(rb_cIO, rb_intern("foreach"), 1+n, args, 0, 0);
|
||||||
}
|
}
|
||||||
else {
|
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 self)
|
|||||||
|
|
||||||
args[0] = get_strpath(self);
|
args[0] = get_strpath(self);
|
||||||
n = rb_scan_args(argc, argv, "03", &args[1], &args[2], &args[3]);
|
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, VALUE self)
|
|||||||
|
|
||||||
args[0] = get_strpath(self);
|
args[0] = get_strpath(self);
|
||||||
n = rb_scan_args(argc, argv, "02", &args[1], &args[2]);
|
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 self)
|
|||||||
|
|
||||||
args[0] = get_strpath(self);
|
args[0] = get_strpath(self);
|
||||||
n = rb_scan_args(argc, argv, "03", &args[1], &args[2], &args[3]);
|
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, VALUE self)
|
|||||||
|
|
||||||
args[0] = get_strpath(self);
|
args[0] = get_strpath(self);
|
||||||
n = rb_scan_args(argc, argv, "03", &args[1], &args[2], &args[3]);
|
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, VALUE self)
|
|||||||
|
|
||||||
args[0] = get_strpath(self);
|
args[0] = get_strpath(self);
|
||||||
n = rb_scan_args(argc, argv, "03", &args[1], &args[2], &args[3]);
|
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, VALUE self)
|
|||||||
|
|
||||||
args[0] = get_strpath(self);
|
args[0] = get_strpath(self);
|
||||||
n = rb_scan_args(argc, argv, "02", &args[1], &args[2]);
|
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 self)
|
|||||||
return rb_block_call(rb_cFile, rb_intern("open"), 1+n, args, 0, 0);
|
return rb_block_call(rb_cFile, rb_intern("open"), 1+n, args, 0, 0);
|
||||||
}
|
}
|
||||||
else {
|
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 klass)
|
|||||||
else {
|
else {
|
||||||
VALUE ary;
|
VALUE ary;
|
||||||
long i;
|
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");
|
ary = rb_convert_type(ary, T_ARRAY, "Array", "to_ary");
|
||||||
for (i = 0; i < RARRAY_LEN(ary); i++) {
|
for (i = 0; i < RARRAY_LEN(ary); i++) {
|
||||||
VALUE elt = RARRAY_AREF(ary, i);
|
VALUE elt = RARRAY_AREF(ary, i);
|
||||||
|
@ -422,7 +422,7 @@ unix_recv_io(int argc, VALUE *argv, VALUE sock)
|
|||||||
ff_argc = mode == Qnil ? 1 : 2;
|
ff_argc = mode == Qnil ? 1 : 2;
|
||||||
ff_argv[0] = INT2FIX(fd);
|
ff_argv[0] = INT2FIX(fd);
|
||||||
ff_argv[1] = mode;
|
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
|
#else
|
||||||
|
@ -383,7 +383,7 @@ static /* [local] */ HRESULT ( STDMETHODCALLTYPE Invoke )(
|
|||||||
mid = rb_intern("value");
|
mid = rb_intern("value");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
v = rb_funcall2(p->obj, mid, args, parg);
|
v = rb_funcallv(p->obj, mid, args, parg);
|
||||||
ole_val2variant(v, pVarResult);
|
ole_val2variant(v, pVarResult);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
4
hash.c
4
hash.c
@ -2588,10 +2588,10 @@ rb_hash_flatten(int argc, VALUE *argv, VALUE hash)
|
|||||||
rb_hash_foreach(hash, flatten_i, ary);
|
rb_hash_foreach(hash, flatten_i, ary);
|
||||||
if (level - 1 > 0) {
|
if (level - 1 > 0) {
|
||||||
*argv = INT2FIX(level - 1);
|
*argv = INT2FIX(level - 1);
|
||||||
rb_funcall2(ary, id_flatten_bang, argc, argv);
|
rb_funcallv(ary, id_flatten_bang, argc, argv);
|
||||||
}
|
}
|
||||||
else if (level < 0) {
|
else if (level < 0) {
|
||||||
rb_funcall2(ary, id_flatten_bang, 0, 0);
|
rb_funcallv(ary, id_flatten_bang, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
14
io.c
14
io.c
@ -6606,7 +6606,7 @@ rb_f_open(int argc, VALUE *argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (redirect) {
|
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()) {
|
if (rb_block_given_p()) {
|
||||||
return rb_ensure(rb_yield, io, io_close, io);
|
return rb_ensure(rb_yield, io, io_close, io);
|
||||||
@ -7079,7 +7079,7 @@ rb_f_putc(VALUE recv, VALUE ch)
|
|||||||
if (recv == rb_stdout) {
|
if (recv == rb_stdout) {
|
||||||
return rb_io_putc(recv, ch);
|
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 recv)
|
|||||||
if (recv == rb_stdout) {
|
if (recv == rb_stdout) {
|
||||||
return rb_io_puts(argc, argv, recv);
|
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
|
void
|
||||||
@ -8206,7 +8206,7 @@ rb_f_gets(int argc, VALUE *argv, VALUE recv)
|
|||||||
if (recv == argf) {
|
if (recv == argf) {
|
||||||
return argf_gets(argc, argv, 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, VALUE recv)
|
|||||||
if (recv == argf) {
|
if (recv == argf) {
|
||||||
return argf_readline(argc, argv, 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, VALUE recv)
|
|||||||
if (recv == argf) {
|
if (recv == argf) {
|
||||||
return argf_readlines(argc, argv, 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, VALUE io)
|
|||||||
VALUE v1, v2, opt;
|
VALUE v1, v2, opt;
|
||||||
|
|
||||||
if (!RB_TYPE_P(io, T_FILE)) {
|
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);
|
argc = rb_scan_args(argc, argv, "11:", &v1, &v2, &opt);
|
||||||
|
2
iseq.c
2
iseq.c
@ -325,7 +325,7 @@ cleanup_iseq_build(rb_iseq_t *iseq)
|
|||||||
compile_data_free(data);
|
compile_data_free(data);
|
||||||
|
|
||||||
if (RTEST(err)) {
|
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);
|
rb_exc_raise(err);
|
||||||
}
|
}
|
||||||
return Qtrue;
|
return Qtrue;
|
||||||
|
8
random.c
8
random.c
@ -957,7 +957,7 @@ rb_random_real(VALUE obj)
|
|||||||
{
|
{
|
||||||
rb_random_t *rnd = try_get_rnd(obj);
|
rb_random_t *rnd = try_get_rnd(obj);
|
||||||
if (!rnd) {
|
if (!rnd) {
|
||||||
VALUE v = rb_funcall2(obj, id_rand, 0, 0);
|
VALUE v = rb_funcallv(obj, id_rand, 0, 0);
|
||||||
double d = NUM2DBL(v);
|
double d = NUM2DBL(v);
|
||||||
if (d < 0.0) {
|
if (d < 0.0) {
|
||||||
rb_raise(rb_eRangeError, "random number too small %g", d);
|
rb_raise(rb_eRangeError, "random number too small %g", d);
|
||||||
@ -1018,7 +1018,7 @@ rb_random_ulong_limited(VALUE obj, unsigned long limit)
|
|||||||
rb_random_t *rnd = try_get_rnd(obj);
|
rb_random_t *rnd = try_get_rnd(obj);
|
||||||
if (!rnd) {
|
if (!rnd) {
|
||||||
VALUE lim = ulong_to_num_plus_1(limit);
|
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);
|
unsigned long r = NUM2ULONG(v);
|
||||||
if (rb_num_negative_p(v)) {
|
if (rb_num_negative_p(v)) {
|
||||||
rb_raise(rb_eRangeError, "random number too small %ld", r);
|
rb_raise(rb_eRangeError, "random number too small %ld", r);
|
||||||
@ -1121,7 +1121,7 @@ range_values(VALUE vmax, VALUE *begp, VALUE *endp, int *exclp)
|
|||||||
if (!rb_range_values(vmax, begp, &end, exclp)) return Qfalse;
|
if (!rb_range_values(vmax, begp, &end, exclp)) return Qfalse;
|
||||||
if (endp) *endp = end;
|
if (endp) *endp = end;
|
||||||
if (!rb_respond_to(end, id_minus)) return Qfalse;
|
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;
|
if (NIL_P(r)) return Qfalse;
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@ -1270,7 +1270,7 @@ rand_range(VALUE obj, rb_random_t* rnd, VALUE range)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return rb_funcall2(beg, id_plus, 1, &v);
|
return rb_funcallv(beg, id_plus, 1, &v);
|
||||||
}
|
}
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
|
@ -605,7 +605,7 @@ f_rational_new_no_reduce2(VALUE klass, VALUE x, VALUE y)
|
|||||||
static VALUE
|
static VALUE
|
||||||
nurat_f_rational(int argc, VALUE *argv, VALUE klass)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
2
ruby.c
2
ruby.c
@ -634,7 +634,7 @@ require_libraries(VALUE *req_list)
|
|||||||
rb_enc_associate(feature, extenc);
|
rb_enc_associate(feature, extenc);
|
||||||
RBASIC_SET_CLASS_RAW(feature, rb_cString);
|
RBASIC_SET_CLASS_RAW(feature, rb_cString);
|
||||||
OBJ_FREEZE(feature);
|
OBJ_FREEZE(feature);
|
||||||
rb_funcall2(self, require, 1, &feature);
|
rb_funcallv(self, require, 1, &feature);
|
||||||
}
|
}
|
||||||
*req_list = 0;
|
*req_list = 0;
|
||||||
}
|
}
|
||||||
|
2
string.c
2
string.c
@ -3526,7 +3526,7 @@ rb_str_match_m(int argc, VALUE *argv, VALUE str)
|
|||||||
rb_check_arity(argc, 1, 2);
|
rb_check_arity(argc, 1, 2);
|
||||||
re = argv[0];
|
re = argv[0];
|
||||||
argv[0] = str;
|
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()) {
|
if (!NIL_P(result) && rb_block_given_p()) {
|
||||||
return rb_yield(result);
|
return rb_yield(result);
|
||||||
}
|
}
|
||||||
|
@ -1157,7 +1157,7 @@ static VALUE
|
|||||||
do_sleep(VALUE args)
|
do_sleep(VALUE args)
|
||||||
{
|
{
|
||||||
struct sleep_call *p = (struct sleep_call *)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
|
static VALUE
|
||||||
|
@ -853,7 +853,7 @@ rb_funcallv(VALUE recv, ID mid, int argc, const VALUE *argv)
|
|||||||
/*!
|
/*!
|
||||||
* Calls a method.
|
* 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 recv receiver of the method
|
||||||
* \param mid an ID that represents the name of the method
|
* \param mid an ID that represents the name of the method
|
||||||
* \param argc the number of arguments
|
* \param argc the number of arguments
|
||||||
@ -1543,7 +1543,7 @@ rb_eval_cmd(VALUE cmd, VALUE arg, int level)
|
|||||||
rb_set_safe_level_force(level);
|
rb_set_safe_level_force(level);
|
||||||
if ((state = TH_EXEC_TAG()) == 0) {
|
if ((state = TH_EXEC_TAG()) == 0) {
|
||||||
if (!RB_TYPE_P(cmd, T_STRING)) {
|
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));
|
RARRAY_CONST_PTR(arg));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1303,7 +1303,7 @@ check_match(VALUE pattern, VALUE target, enum vm_check_match_type type)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* fallback to funcall (e.g. method_missing) */
|
/* fallback to funcall (e.g. method_missing) */
|
||||||
return rb_funcall2(pattern, idEqq, 1, &target);
|
return rb_funcallv(pattern, idEqq, 1, &target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -610,7 +610,7 @@ rb_method_entry_make(VALUE klass, ID mid, VALUE defined_class, rb_method_visibil
|
|||||||
recv_class = rb_ivar_get((klass), attached); \
|
recv_class = rb_ivar_get((klass), attached); \
|
||||||
hook_id = singleton_##hook; \
|
hook_id = singleton_##hook; \
|
||||||
} \
|
} \
|
||||||
rb_funcall2(recv_class, hook_id, 1, &arg); \
|
rb_funcallv(recv_class, hook_id, 1, &arg); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user