mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* vm_eval.c (method_missing): use ALLOCV_N() instead of
ALLOCA_N() and rb_ary_tmp_new(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
56b0396944
commit
b66d7182b7
2 changed files with 8 additions and 10 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Jan 2 01:23:30 2014 Masaki Matsushita <glass.saga@gmail.com>
|
||||
|
||||
* vm_eval.c (method_missing): use ALLOCV_N() instead of
|
||||
ALLOCA_N() and rb_ary_tmp_new().
|
||||
|
||||
Thu Jan 2 00:53:16 2014 Masaki Matsushita <glass.saga@gmail.com>
|
||||
|
||||
* array.c (rb_ary_zip): use ALLOCV_N() instead of ALLOCA_N().
|
||||
|
|
13
vm_eval.c
13
vm_eval.c
|
@ -695,7 +695,7 @@ raise_method_missing(rb_thread_t *th, int argc, const VALUE *argv, VALUE obj,
|
|||
static inline VALUE
|
||||
method_missing(VALUE obj, ID id, int argc, const VALUE *argv, int call_status)
|
||||
{
|
||||
VALUE *nargv, result, argv_ary = 0;
|
||||
VALUE *nargv, result, work;
|
||||
rb_thread_t *th = GET_THREAD();
|
||||
const rb_block_t *blockptr = th->passed_block;
|
||||
|
||||
|
@ -706,23 +706,16 @@ method_missing(VALUE obj, ID id, int argc, const VALUE *argv, int call_status)
|
|||
raise_method_missing(th, argc, argv, obj, call_status | NOEX_MISSING);
|
||||
}
|
||||
|
||||
if (argc < 0x100) {
|
||||
nargv = ALLOCA_N(VALUE, argc + 1);
|
||||
}
|
||||
else {
|
||||
argv_ary = rb_ary_tmp_new(argc + 1);
|
||||
nargv = RARRAY_PTR(argv_ary);
|
||||
}
|
||||
nargv = ALLOCV_N(VALUE, work, argc + 1);
|
||||
nargv[0] = ID2SYM(id);
|
||||
MEMCPY(nargv + 1, argv, VALUE, argc);
|
||||
if (argv_ary) rb_ary_set_len(argv_ary, argc + 1);
|
||||
|
||||
if (rb_method_basic_definition_p(CLASS_OF(obj) , idMethodMissing)) {
|
||||
raise_method_missing(th, argc+1, nargv, obj, call_status | NOEX_MISSING);
|
||||
}
|
||||
th->passed_block = blockptr;
|
||||
result = rb_funcall2(obj, idMethodMissing, argc + 1, nargv);
|
||||
if (argv_ary) rb_ary_clear(argv_ary);
|
||||
if (work) ALLOCV_END(work);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue