summaryrefslogtreecommitdiff
path: root/enumerator.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-15 15:32:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-15 15:32:28 +0000
commit5987e6a50b92e2e0910c9b4265be4ce57ea82e58 (patch)
tree362640a22a23ba31c67e529d3ab6f5bf7e5dc95f /enumerator.c
parente996628bec29e6d76e7867dea5ca706c4743774e (diff)
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
Diffstat (limited to 'enumerator.c')
-rw-r--r--enumerator.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/enumerator.c b/enumerator.c
index f83a2ca..a59473a 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;