mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* re.c (rb_reg_expr_str): should treat backslash specially in
escaping. * io.c: complete off_t handling; missing argument for fptr_finalize(); polished rb_scan_args call. * dir.c: wrap multi-statment macro by do { } while (0) * eval.c, numeric,c, sprintf.c, util.c: ditto. * bignum.c (rb_big_eq): check `y == x' if y is neither Fixnum, Bignum, nor Float. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8a7b08bb78
commit
e63a990141
23 changed files with 146 additions and 98 deletions
12
random.c
12
random.c
|
@ -6,7 +6,7 @@
|
|||
$Date$
|
||||
created at: Fri Dec 24 16:39:21 JST 1993
|
||||
|
||||
Copyright (C) 1993-2001 Yukihiro Matsumoto
|
||||
Copyright (C) 1993-2002 Yukihiro Matsumoto
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
|
@ -77,7 +77,7 @@ void srand48 _((long));
|
|||
#endif /* not HAVE_DRAND48 */
|
||||
|
||||
static int first = 1;
|
||||
#ifdef HAVE_RANDOM
|
||||
#ifdef HAVE_INITSTATE
|
||||
static char state[256];
|
||||
#endif
|
||||
|
||||
|
@ -88,7 +88,7 @@ rand_init(seed)
|
|||
int old;
|
||||
static unsigned int saved_seed;
|
||||
|
||||
#if defined HAVE_INITSTATE
|
||||
#ifdef HAVE_INITSTATE
|
||||
if (first == 1) {
|
||||
initstate(1, state, sizeof state);
|
||||
}
|
||||
|
@ -111,11 +111,11 @@ rb_f_srand(argc, argv, obj)
|
|||
VALUE *argv;
|
||||
VALUE obj;
|
||||
{
|
||||
VALUE a;
|
||||
VALUE sd;
|
||||
unsigned int seed, old;
|
||||
|
||||
rb_secure(4);
|
||||
if (rb_scan_args(argc, argv, "01", &a) == 0) {
|
||||
if (rb_scan_args(argc, argv, "01", &sd) == 0) {
|
||||
static int n = 0;
|
||||
struct timeval tv;
|
||||
|
||||
|
@ -123,7 +123,7 @@ rb_f_srand(argc, argv, obj)
|
|||
seed = tv.tv_sec ^ tv.tv_usec ^ getpid() ^ n++;
|
||||
}
|
||||
else {
|
||||
seed = NUM2UINT(a);
|
||||
seed = NUM2UINT(sd);
|
||||
}
|
||||
old = rand_init(seed);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue