From 5987e6a50b92e2e0910c9b4265be4ce57ea82e58 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 15 Dec 2015 15:32:28 +0000 Subject: [PATCH] enumerator.c: use ALLOCV * enumerator.c (lazy_init_iterator): use ALLOCV instead of tmp array. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- enumerator.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/enumerator.c b/enumerator.c index f83a2ca08b..a59473a88c 100644 --- a/enumerator.c +++ b/enumerator.c @@ -1331,14 +1331,14 @@ lazy_init_iterator(RB_BLOCK_CALL_FUNC_ARGLIST(val, m)) else { VALUE args; int len = rb_long2int((long)argc + 1); + VALUE *nargv = ALLOCV_N(VALUE, args, len); - args = rb_ary_tmp_new(len); - rb_ary_push(args, m); + nargv[0] = m; if (argc > 0) { - rb_ary_cat(args, argv, argc); + MEMCPY(nargv + 1, argv, VALUE, argc); } - result = rb_yield_values2(len, RARRAY_CONST_PTR(args)); - RB_GC_GUARD(args); + result = rb_yield_values2(len, nargv); + ALLOCV_END(args); } if (result == Qundef) rb_iter_break(); return Qnil;