From 2531892cbc997ae25a121e21cca321722ec663c3 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Wed, 25 Aug 2010 12:14:38 +0000 Subject: reverted to r29091; r29092 breaks test-all git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- array.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'array.c') diff --git a/array.c b/array.c index 9e15e9aa58..172a653aa2 100644 --- a/array.c +++ b/array.c @@ -3748,7 +3748,7 @@ static VALUE sym_random; static VALUE rb_ary_shuffle_bang(int argc, VALUE *argv, VALUE ary) { - VALUE *ptr, opts, randgen = rb_cRandom; + VALUE *ptr, opts, randgen = Qnil; long i = RARRAY_LEN(ary); if (OPTHASH_GIVEN_P(opts)) { @@ -3811,7 +3811,7 @@ static VALUE rb_ary_sample(int argc, VALUE *argv, VALUE ary) { VALUE nv, result, *ptr; - VALUE opts, randgen = rb_cRandom; + VALUE opts, randgen = Qnil; long n, len, i, j, k, idx[10]; len = RARRAY_LEN(ary); @@ -3826,7 +3826,6 @@ rb_ary_sample(int argc, VALUE *argv, VALUE ary) rb_scan_args(argc, argv, "1", &nv); n = NUM2LONG(nv); if (n < 0) rb_raise(rb_eArgError, "negative sample number"); - RB_GC_GUARD(ary) = ary_make_shared(ary); ptr = RARRAY_PTR(ary); len = RARRAY_LEN(ary); if (n > len) n = len; @@ -3873,6 +3872,7 @@ rb_ary_sample(int argc, VALUE *argv, VALUE ary) VALUE *ptr_result; result = rb_ary_new4(len, ptr); ptr_result = RARRAY_PTR(result); + RB_GC_GUARD(ary); for (i=0; i