diff options
| author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-21 06:06:10 +0000 |
|---|---|---|
| committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-21 06:06:10 +0000 |
| commit | 30026d8e4b32ffafe4427f562de0cb8718786b67 (patch) | |
| tree | 84cdedeb3b63a55b2da4398e0fcd2bc35e77f439 | |
| parent | c7b7670c0fbbc34a98ea512d225cfbedcff7ecc6 (diff) | |
| download | ruby-30026d8e4b32ffafe4427f562de0cb8718786b67.tar.gz ruby-30026d8e4b32ffafe4427f562de0cb8718786b67.tar.xz ruby-30026d8e4b32ffafe4427f562de0cb8718786b67.zip | |
* array.c (rb_ary_permutation): add gc guard codes.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | array.c | 6 |
2 files changed, 8 insertions, 2 deletions
@@ -1,3 +1,7 @@ +Wed Nov 21 14:55:13 2007 Koichi Sasada <ko1@atdot.net> + + * array.c (rb_ary_permutation): add gc guard codes. + Wed Nov 21 03:12:50 2007 Yukihiro Matsumoto <matz@ruby-lang.org> * process.c (rb_f_system): returns nil on execution failure. @@ -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; } |
