1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* array.c (rb_ary_product): Make defensive copy in case of block...

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
marcandre 2010-04-02 22:44:17 +00:00
parent d0a98a0e90
commit 94ab139bc9

View file

@ -4103,7 +4103,11 @@ rb_ary_product(int argc, VALUE *argv, VALUE ary)
}
/* Otherwise, allocate and fill in an array of results */
if (!rb_block_given_p()) {
if (rb_block_given_p()) {
/* Make defensive copies of arrays */
for (i = 0; i < n; i++) arrays[i] = ary_make_substitution(arrays[i]);
}
else {
result = rb_ary_new2(resultlen);
}
for (i = 0; i < resultlen; i++) {