[PATCH] Add simple versions of random() and srandom()

Yaakov Selkowitz yselkowitz@cygwin.com
Wed Mar 23 17:45:00 GMT 2016


On 2016-03-23 12:38, Joel Sherrill wrote:
> --- a/newlib/libc/include/stdlib.h
> +++ b/newlib/libc/include/stdlib.h
> @@ -226,6 +226,12 @@ unsigned short *
>   _VOID  _EXFUN(srand48,(long));
>   _VOID  _EXFUN(_srand48_r,(struct _reent *, long));
>   #endif /* __SVID_VISIBLE || __XSI_VISIBLE */
> +#if __SVID_VISIBLE || __XSI_VISIBLE >= 4 || __BSD_VISIBLE

Please review my previous comment on this.

> +ANSI_SYNOPSIS
> +	#define _XOPEN_SOURCE 500
> +	#include <stdlib.h>
> +	long int random(void);
> +	void srandom(unsigned int <[seed]>);

This doesn't match the header guard, nor does it account for the 
multiple options.

> +PORTABILITY
> +<<random>> is required by POSIX.

Actually, it's XSI.

-- 
Yaakov



More information about the Newlib mailing list