summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-21 06:06:10 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-21 06:06:10 +0000
commit53b3bf961cd4f4de0388d56c7d8b5059eba1c3c0 (patch)
tree84cdedeb3b63a55b2da4398e0fcd2bc35e77f439 /array.c
parentd154b1c346448b432245d19147502bbffb796cb5 (diff)
* array.c (rb_ary_permutation): add gc guard codes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/array.c b/array.c
index 403d8b3c5a..b0010672c4 100644
--- a/array.c
+++ b/array.c
@@ -3047,15 +3047,17 @@ rb_ary_permutation(int argc, VALUE *argv, VALUE ary)
}
}
else { /* this is the general case */
- volatile VALUE t0 = tmpbuf(n,sizeof(long));
+ VALUE t0 = tmpbuf(n,sizeof(long));
long *p = (long*)RSTRING_PTR(t0);
- volatile VALUE t1 = tmpbuf(n,sizeof(int));
+ VALUE t1 = tmpbuf(n,sizeof(int));
int *used = (int*)RSTRING_PTR(t1);
VALUE ary0 = ary_make_shared(ary); /* private defensive copy of ary */
for (i = 0; i < n; i++) used[i] = 0; /* initialize array */
permute0(n, r, p, 0, used, ary0); /* compute and yield permutations */
+ RB_GC_GUARD(t0);
+ RB_GC_GUARD(t1);
}
return ary;
}