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 !@HAVE_STRUCT_RANDOM_DATA@ || (@GNULIB_RANDOM_R@ && !@HAVE_RANDOM_R@) \
> -    || defined GNULIB_POSIXCHECK
> +#if !@HAVE_STRUCT_RANDOM_DATA@ || (@GNULIB_RANDOM_R@ && !@HAVE_RANDOM_R@)
>  # 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 !@HAVE_STRUCT_RANDOM_DATA@ || (@GNULIB_RANDOM_R@ && !@HAVE_RANDOM_R@) \
-    || defined GNULIB_POSIXCHECK
+#if @GNULIB_RANDOM_R@ && (!@HAVE_STRUCT_RANDOM_DATA@ || !@HAVE_RANDOM_R@)
 # include <stdint.h>
 #endif
 
-#if !@HAVE_STRUCT_RANDOM_DATA@
+#if @GNULIB_RANDOM_R@ && !@HAVE_STRUCT_RANDOM_DATA@
 /* 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