summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-03 06:56:57 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-03 06:56:57 +0000
commit34401f9014c0d983f66d144ca8cccd25b1fe47a7 (patch)
tree858d991843cb4d045db48b840c9f2c8545762527 /array.c
parent49816a25525e96e6d78e013ad632555a83672187 (diff)
* array.c (permute0): use chars for boolean array.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/array.c b/array.c
index 7b5e7ab063..b6a8900049 100644
--- a/array.c
+++ b/array.c
@@ -3664,7 +3664,7 @@ rb_ary_cycle(int argc, VALUE *argv, VALUE ary)
* values: the Ruby array that holds the actual values to permute
*/
static void
-permute0(long n, long r, long *p, long index, int *used, VALUE values)
+permute0(long n, long r, long *p, long index, char *used, VALUE values)
{
long i,j;
for (i = 0; i < n; i++) {
@@ -3746,12 +3746,12 @@ rb_ary_permutation(int argc, VALUE *argv, VALUE ary)
else { /* this is the general case */
volatile VALUE t0 = tmpbuf(n,sizeof(long));
long *p = (long*)RSTRING_PTR(t0);
- volatile VALUE t1 = tmpbuf(n,sizeof(int));
- int *used = (int*)RSTRING_PTR(t1);
+ volatile VALUE t1 = tmpbuf(n,sizeof(char));
+ char *used = (char*)RSTRING_PTR(t1);
VALUE ary0 = ary_make_substitution(ary); /* private defensive copy of ary */
RBASIC(ary0)->klass = 0;
- for (i = 0; i < n; i++) used[i] = 0; /* initialize array */
+ MEMZERO(used, char, n); /* initialize array */
permute0(n, r, p, 0, used, ary0); /* compute and yield permutations */
tmpbuf_discard(t0);