* random.c (rand_init): use ALLOC_N instead of ALLOCA_N

by TAMURA Takashi.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2005-01-07 14:04:30 +00:00
parent 36c839f233
commit ea06d92507
2 changed files with 6 additions and 2 deletions

View File

@ -1,3 +1,7 @@
Fri Jan 7 21:12:29 2005 TAMURA Takashi <sheepman@tcn.zaq.ne.jp>
* random.c (rand_init): use ALLOC_N instead of ALLOCA_N
Fri Jan 7 20:01:31 2005 GOTOU Yuuzou <gotoyuzo@notwork.org> Fri Jan 7 20:01:31 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
* lib/webrick/httpproxy.rb (WEBrick::HTTPProxyServer#proxy_service): * lib/webrick/httpproxy.rb (WEBrick::HTTPProxyServer#proxy_service):

View File

@ -216,7 +216,7 @@ rand_init(vseed)
rb_obj_classname(vseed)); rb_obj_classname(vseed));
} }
len = (len + 3) / 4; /* number of 32bit words */ len = (len + 3) / 4; /* number of 32bit words */
buf = ALLOCA_N(long, len); /* allocate longs for init_by_array */ buf = ALLOC_N(long, len); /* allocate longs for init_by_array */
memset(buf, 0, len * sizeof(long)); memset(buf, 0, len * sizeof(long));
if (FIXNUM_P(seed)) { if (FIXNUM_P(seed)) {
buf[0] = FIX2ULONG(seed) & 0xffffffff; buf[0] = FIX2ULONG(seed) & 0xffffffff;
@ -248,7 +248,7 @@ rand_init(vseed)
first = 0; first = 0;
old = saved_seed; old = saved_seed;
saved_seed = seed; saved_seed = seed;
free(buf);
return old; return old;
} }