Fix typing of srandom() and initstate().
POSIX requires that these functions have an unsigned int for their first argument; not an unsigned long. My reasoning is that we can safely change these functions without breaking the ABI. As far as I know, our supported architectures either use registers for passing function arguments that are at least as big as long (e.g., amd64), or int and long are of the same size (e.g., i386). Reviewed by: ache Differential Revision: https://reviews.freebsd.org/D6644
This commit is contained in:
parent
7ee4fff4e7
commit
8de6c26711
@ -204,7 +204,7 @@ double erand48(unsigned short[3]);
|
||||
/* char *fcvt(double, int, int * __restrict, int * __restrict); */
|
||||
/* char *gcvt(double, int, int * __restrict, int * __restrict); */
|
||||
int grantpt(int);
|
||||
char *initstate(unsigned long /* XSI requires u_int */, char *, long);
|
||||
char *initstate(unsigned int, char *, size_t);
|
||||
long jrand48(unsigned short[3]);
|
||||
char *l64a(long);
|
||||
void lcong48(unsigned short[7]);
|
||||
@ -227,7 +227,7 @@ int setkey(const char *);
|
||||
#endif
|
||||
char *setstate(/* const */ char *);
|
||||
void srand48(long);
|
||||
void srandom(unsigned long);
|
||||
void srandom(unsigned int);
|
||||
int unlockpt(int);
|
||||
#endif /* __XSI_VISIBLE */
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
.\" @(#)random.3 8.1 (Berkeley) 6/4/93
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd April 2, 2013
|
||||
.Dd July 26, 2016
|
||||
.Dt RANDOM 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -45,11 +45,11 @@
|
||||
.Ft long
|
||||
.Fn random void
|
||||
.Ft void
|
||||
.Fn srandom "unsigned long seed"
|
||||
.Fn srandom "unsigned int seed"
|
||||
.Ft void
|
||||
.Fn srandomdev void
|
||||
.Ft char *
|
||||
.Fn initstate "unsigned long seed" "char *state" "long n"
|
||||
.Fn initstate "unsigned int seed" "char *state" "size_t n"
|
||||
.Ft char *
|
||||
.Fn setstate "char *state"
|
||||
.Sh DESCRIPTION
|
||||
|
@ -236,7 +236,7 @@ good_rand(uint32_t ctx)
|
||||
* for default usage relies on values produced by this routine.
|
||||
*/
|
||||
void
|
||||
srandom(unsigned long x)
|
||||
srandom(unsigned int x)
|
||||
{
|
||||
int i, lim;
|
||||
|
||||
@ -311,7 +311,7 @@ srandomdev(void)
|
||||
* complain about mis-alignment, but you should disregard these messages.
|
||||
*/
|
||||
char *
|
||||
initstate(unsigned long seed, char *arg_state, long n)
|
||||
initstate(unsigned int seed, char *arg_state, size_t n)
|
||||
{
|
||||
char *ostate = (char *)(&state[-1]);
|
||||
uint32_t *int_arg_state = (uint32_t *)arg_state;
|
||||
|
Loading…
Reference in New Issue
Block a user