bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: struct random_data in <stdlib.h>


From: Bruno Haible
Subject: Re: struct random_data in <stdlib.h>
Date: Tue, 8 Feb 2011 11:51:30 +0100
User-agent: KMail/1.9.9

Hi Paul,

> The stdlib patch removes an unnecessary dependency on stdint.

OK. The idea behind defining 'struct random_data' in <stdlib.h> also when
the 'random_r' module is not requested is that glibc has this type in
<stdlib.h>, hence so should gnulib.

But I can agree that having it defined only together with the 'random_r'
module is acceptable.

> diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
> index a9b284c..b3bb9d4 100644
> --- a/lib/stdlib.in.h
> +++ b/lib/stdlib.in.h
> @@ -55,8 +55,7 @@
>  # include <random.h>
>  #endif
>  
> -#if address@hidden@ || (@GNULIB_RANDOM_R@ && address@hidden@) \
> -    || defined GNULIB_POSIXCHECK
> +#if address@hidden@ || (@GNULIB_RANDOM_R@ && address@hidden@)
>  # include <stdint.h>
>  #endif
>  

This is correct, but does not make it outright clear that you need 'random_r'
in order to get the 'struct random_data' type. I would prefer this patch
instead:

--- lib/stdlib.in.h.orig        Tue Feb  8 11:50:31 2011
+++ lib/stdlib.in.h     Tue Feb  8 11:50:19 2011
@@ -50,17 +50,17 @@
 #endif
 
 /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
-   from <stdlib.h> if _REENTRANT is defined.  Include it always.  */
-#if @HAVE_RANDOM_H@
+   from <stdlib.h> if _REENTRANT is defined.  Include it whenever we need
+   'struct random_data'.  */
+#if @GNULIB_RANDOM_R@ && @HAVE_RANDOM_H@
 # include <random.h>
 #endif
 
-#if address@hidden@ || (@GNULIB_RANDOM_R@ && address@hidden@) \
-    || defined GNULIB_POSIXCHECK
+#if @GNULIB_RANDOM_R@ && (address@hidden@ || address@hidden@)
 # include <stdint.h>
 #endif
 
-#if address@hidden@
+#if @GNULIB_RANDOM_R@ && address@hidden@
 /* Define 'struct random_data'.
    But allow multiple gnulib generated <stdlib.h> replacements to coexist.  */
 # if !GNULIB_defined_struct_random_data


Bruno
-- 
In memoriam Ismail Semed <http://en.wikipedia.org/wiki/Ismail_Semed>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]