summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--array.c8
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 2e4ac6b51dd..239b487f1e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sun Aug 2 20:09:07 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_combination, rb_ary_product): prevent from GC.
+
Sun Aug 2 16:53:19 2009 Yusuke Endoh <mame@tsg.ne.jp>
* test/ruby/test_rand.rb: add tests for Random#float's rejection
diff --git a/array.c b/array.c
index 0edbda46ccd..bf471879060 100644
--- a/array.c
+++ b/array.c
@@ -3748,8 +3748,8 @@ rb_ary_permutation(int argc, VALUE *argv, VALUE 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);
+ ary_discard(t0);
+ ary_discard(t1);
RBASIC(ary0)->klass = rb_cArray;
}
return ary;
@@ -3839,6 +3839,8 @@ rb_ary_combination(VALUE ary, VALUE num)
stack[lev--]++;
} while (lev && (stack[lev+1]+n == len+lev+1));
}
+ ary_discard(t0);
+ ary_discard(cc);
}
return ary;
}
@@ -3916,6 +3918,8 @@ rb_ary_product(int argc, VALUE *argv, VALUE ary)
counters[m]++;
}
}
+ ary_discard(t0);
+ ary_discard(t1);
return result;
}