Loading...
stdlib/FreeBSD/random.c.patch /dev/null Libc-498.1.7
--- /dev/null
+++ Libc/Libc-498.1.7/stdlib/FreeBSD/random.c.patch
@@ -0,0 +1,56 @@
+--- random.c.org	2006-09-08 18:48:58.000000000 -0700
++++ random.c	2006-09-08 18:50:03.000000000 -0700
+@@ -37,6 +37,14 @@
+ #include <sys/cdefs.h>
+ __FBSDID("$FreeBSD: src/lib/libc/stdlib/random.c,v 1.24 2004/01/20 03:02:18 das Exp $");
+ 
++/*
++ * We always compile with __DARWIN_UNIX03 set to one, relying on the fact that
++ * (for non-LP64) sizeof(int) == sizeof(long) == sizeof(size_t), so that we
++ * don't have to have two different versions of the prototypes.  For LP64,
++ * we only support the POSIX-compatible prototypes.
++ */
++#undef 	__DARWIN_UNIX03
++#define	__DARWIN_UNIX03	1
+ #include "namespace.h"
+ #include <sys/time.h>          /* for srandomdev() */
+ #include <fcntl.h>             /* for srandomdev() */
+@@ -220,7 +228,7 @@
+ static int rand_sep = SEP_3;
+ static uint32_t *end_ptr = &randtbl[DEG_3 + 1];
+ 
+-static inline uint32_t good_rand(int32_t);
++static inline uint32_t good_rand(int32_t) __attribute__((always_inline));
+ 
+ static inline uint32_t good_rand (x)
+ 	int32_t x;
+@@ -269,7 +277,7 @@
+  */
+ void
+ srandom(x)
+-	unsigned long x;
++	unsigned x;
+ {
+ 	int i, lim;
+ 
+@@ -357,9 +365,9 @@
+  */
+ char *
+ initstate(seed, arg_state, n)
+-	unsigned long seed;		/* seed for R.N.G. */
++	unsigned seed;		/* seed for R.N.G. */
+ 	char *arg_state;		/* pointer to state array */
+-	long n;				/* # bytes of state info */
++	size_t n;				/* # bytes of state info */
+ {
+ 	char *ostate = (char *)(&state[-1]);
+ 	uint32_t *int_arg_state = (uint32_t *)arg_state;
+@@ -425,7 +433,7 @@
+  */
+ char *
+ setstate(arg_state)
+-	char *arg_state;		/* pointer to state array */
++	const char *arg_state;		/* pointer to state array */
+ {
+ 	uint32_t *new_state = (uint32_t *)arg_state;
+ 	uint32_t type = new_state[0] % MAX_TYPES;