diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | array.c | 2 |
2 files changed, 6 insertions, 0 deletions
@@ -1,3 +1,7 @@ +Thu Oct 30 21:32:15 2008 Yusuke Endoh <mame@tsg.ne.jp> + + * array.c (rb_ary_permutation): hide temporal array. + Thu Oct 30 09:31:45 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> * encoding.c (rb_locale_encoding): makes an alias for locale. @@ -3463,12 +3463,14 @@ rb_ary_permutation(int argc, VALUE *argv, VALUE ary) volatile VALUE t1 = tmpbuf(n,sizeof(int)); int *used = (int*)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 */ permute0(n, r, p, 0, used, ary0); /* compute and yield permutations */ RB_GC_GUARD(t0); RB_GC_GUARD(t1); + RBASIC(ary0)->klass = rb_cArray; } return ary; } |