proc.c: no unnecessary temporary array
* proc.c (bmcall): get rid of making temporary single element array. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5c19519e8c
commit
cfc29cf289
5
proc.c
5
proc.c
@ -2533,12 +2533,9 @@ bmcall(VALUE args, VALUE method, int argc, VALUE *argv, VALUE passed_proc)
|
|||||||
VALUE ret;
|
VALUE ret;
|
||||||
|
|
||||||
if (CLASS_OF(args) != rb_cArray) {
|
if (CLASS_OF(args) != rb_cArray) {
|
||||||
args = rb_ary_new3(1, args);
|
return rb_method_call_with_block(1, &args, method, passed_proc);
|
||||||
argc = 1;
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
argc = check_argc(RARRAY_LEN(args));
|
argc = check_argc(RARRAY_LEN(args));
|
||||||
}
|
|
||||||
ret = rb_method_call_with_block(argc, RARRAY_PTR(args), method, passed_proc);
|
ret = rb_method_call_with_block(argc, RARRAY_PTR(args), method, passed_proc);
|
||||||
RB_GC_GUARD(a) = args;
|
RB_GC_GUARD(a) = args;
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user