mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
Fix random() and srandom() prototypes to match the standard.
These prototypes were needlessly different from the standard. Fix them to be the same, and fix the surrounding code after the changes. Sponsored by: Netflix
This commit is contained in:
parent
9462787dba
commit
dcaa2d76dc
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326445
|
@ -169,10 +169,10 @@ may be used to prevent a variable being unset.
|
|||
.Xc
|
||||
.It Xo
|
||||
.Ft void
|
||||
.Fn srandom "unsigned long seed"
|
||||
.Fn srandom "unsigned int seed"
|
||||
.Xc
|
||||
.It Xo
|
||||
.Ft "unsigned long"
|
||||
.Ft "long"
|
||||
.Fn random void
|
||||
.Xc
|
||||
.It Xo
|
||||
|
|
|
@ -34,12 +34,12 @@ __FBSDID("$FreeBSD$");
|
|||
|
||||
#include <sys/types.h>
|
||||
|
||||
static u_long randseed = 1;
|
||||
static long randseed = 1;
|
||||
|
||||
void
|
||||
srandom(seed)
|
||||
u_long seed;
|
||||
srandom(unsigned int seed)
|
||||
{
|
||||
|
||||
randseed = seed;
|
||||
}
|
||||
|
||||
|
@ -48,8 +48,8 @@ srandom(seed)
|
|||
* and whatever else we might use it for. The result is uniform on
|
||||
* [0, 2^31 - 1].
|
||||
*/
|
||||
u_long
|
||||
random()
|
||||
long
|
||||
random(void)
|
||||
{
|
||||
long x, hi, lo, t;
|
||||
|
||||
|
|
|
@ -281,7 +281,7 @@ extern ssize_t read(int, void *, size_t);
|
|||
extern ssize_t write(int, void *, size_t);
|
||||
extern struct dirent *readdirfd(int);
|
||||
|
||||
extern void srandom(u_long seed);
|
||||
extern void srandom(unsigned int);
|
||||
extern u_long random(void);
|
||||
|
||||
/* imports from stdlib, locally modified */
|
||||
|
|
Loading…
Reference in a new issue