aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-06 06:29:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-06 06:29:55 +0000
commit80c9b6646ee47c4f395bfa74550cab7d010dfb14 (patch)
tree72c4de4e628d19a193af53de8731957ac3c2051d
parent0c13d23d08c6f4dbe54d8f9059b9606b64d0e500 (diff)
downloadruby-80c9b6646ee47c4f395bfa74550cab7d010dfb14.tar.gz
random.c: return value is not GCed
* random.c (rand_init): since seed is the return value, no needs to be volatile to prevent from GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--random.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/random.c b/random.c
index c6fb9e0574..65db49d677 100644
--- a/random.c
+++ b/random.c
@@ -380,14 +380,13 @@ random_alloc(VALUE klass)
}
static VALUE
-rand_init(struct MT *mt, VALUE vseed)
+rand_init(struct MT *mt, VALUE seed)
{
- volatile VALUE seed;
uint32_t buf0[SIZEOF_LONG / SIZEOF_INT32 * 4], *buf = buf0;
size_t len;
int sign;
- seed = rb_to_int(vseed);
+ seed = rb_to_int(seed);
len = rb_absint_numwords(seed, 32, NULL);
if (len > numberof(buf0))