summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authorglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-01 15:55:51 +0000
committerglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-01 15:55:51 +0000
commit56b039694461bd0dee18454e1d7639efc7bc3557 (patch)
treeb368910a332c834a347d1af6cbd4b37a511af5ce /array.c
parentedc5eb0d3b87eb8f8ec8579c7f610bc0273023e4 (diff)
* array.c (rb_ary_zip): use ALLOCV_N() instead of ALLOCA_N().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/array.c b/array.c
index 45713c55b0..c4869789e5 100644
--- a/array.c
+++ b/array.c
@@ -3240,8 +3240,10 @@ rb_ary_zip(int argc, VALUE *argv, VALUE ary)
if (rb_block_given_p()) {
int arity = rb_block_arity();
- if (arity > 1 && argc+1 < 0x100) {
- VALUE *tmp = ALLOCA_N(VALUE, argc+1);
+ if (arity > 1) {
+ VALUE work, *tmp;
+
+ tmp = ALLOCV_N(VALUE, work, argc+1);
for (i=0; i<RARRAY_LEN(ary); i++) {
tmp[0] = RARRAY_AREF(ary, i);
@@ -3250,6 +3252,8 @@ rb_ary_zip(int argc, VALUE *argv, VALUE ary)
}
rb_yield_values2(argc+1, tmp);
}
+
+ if (work) ALLOCV_END(work);
}
else {
for (i=0; i<RARRAY_LEN(ary); i++) {