1 --- random.c.bsdnew 2009-11-13 14:11:50.000000000 -0800
2 +++ random.c 2009-11-13 14:11:51.000000000 -0800
3 @@ -33,6 +33,14 @@ static char sccsid[] = "@(#)random.c 8.2
5 __FBSDID("$FreeBSD: src/lib/libc/stdlib/random.c,v 1.25 2007/01/09 00:28:10 imp Exp $");
8 + * We always compile with __DARWIN_UNIX03 set to one, relying on the fact that
9 + * (for non-LP64) sizeof(int) == sizeof(long) == sizeof(size_t), so that we
10 + * don't have to have two different versions of the prototypes. For LP64,
11 + * we only support the POSIX-compatible prototypes.
13 +#undef __DARWIN_UNIX03
14 +#define __DARWIN_UNIX03 1
15 #include "namespace.h"
16 #include <sys/time.h> /* for srandomdev() */
17 #include <fcntl.h> /* for srandomdev() */
18 @@ -216,7 +224,7 @@ static int rand_deg = DEG_3;
19 static int rand_sep = SEP_3;
20 static uint32_t *end_ptr = &randtbl[DEG_3 + 1];
22 -static inline uint32_t good_rand(int32_t);
23 +static inline uint32_t good_rand(int32_t) __attribute__((always_inline));
25 static inline uint32_t good_rand (x)
27 @@ -265,7 +273,7 @@ static inline uint32_t good_rand (x)
36 @@ -353,9 +361,9 @@ srandomdev()
39 initstate(seed, arg_state, n)
40 - unsigned long seed; /* seed for R.N.G. */
41 + unsigned seed; /* seed for R.N.G. */
42 char *arg_state; /* pointer to state array */
43 - long n; /* # bytes of state info */
44 + size_t n; /* # bytes of state info */
46 char *ostate = (char *)(&state[-1]);
47 uint32_t *int_arg_state = (uint32_t *)arg_state;
48 @@ -421,7 +429,7 @@ initstate(seed, arg_state, n)
52 - char *arg_state; /* pointer to state array */
53 + const char *arg_state; /* pointer to state array */
55 uint32_t *new_state = (uint32_t *)arg_state;
56 uint32_t type = new_state[0] % MAX_TYPES;