mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
0c13d23d08
commit
80c9b6646e
1 changed files with 2 additions and 3 deletions
5
random.c
5
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))
|
||||
|
|
Loading…
Add table
Reference in a new issue