string, sys_select: Avoid #including large headers unless necessary.
authorBruno Haible <bruno@clisp.org>
Wed, 6 Oct 2010 22:52:15 +0000 (00:52 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 6 Oct 2010 22:52:15 +0000 (00:52 +0200)
* lib/string.in.h: Don't include <unistd.h> except on NetBSD.
* lib/sys_select.in.h: Don't include <string.h> except on Solaris,
OSF/1, BeOS, Haiku.
Reported by Jim Meyering.

ChangeLog
lib/string.in.h
lib/sys_select.in.h

index 19b5be8314f67150832b5e78192a981f53c4d80e..643cc441bb0b1c7f2d1466640f56419ff83cd62f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-10-06  Bruno Haible  <bruno@clisp.org>
+
+       string, sys_select: Avoid #including large headers unless necessary.
+       * lib/string.in.h: Don't include <unistd.h> except on NetBSD.
+       * lib/sys_select.in.h: Don't include <string.h> except on Solaris,
+       OSF/1, BeOS, Haiku.
+       Reported by Jim Meyering.
+
 2010-10-05  Eric Blake  <eblake@redhat.com>
 
        memmem, strstr, strcasestr: fix bug with long periodic needle
index 6b848955a8e663dce618254a6f62bdfb65f03a6c..879e06d9cc6c313979451c0415a1895ab0c7b06f 100644 (file)
@@ -51,8 +51,8 @@
 #endif
 
 /* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>.  */
-/* But avoid namespace pollution on glibc systems.  */
-#if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK)  \
+/* But in any case avoid namespace pollution on glibc systems.  */
+#if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \
     && ! defined __GLIBC__
 # include <unistd.h>
 #endif
index 8f4fa0268c12b604ce25bb3f93554712d215e950..f9b850cebff77a1699dc4d3f8b7feabf087e442c 100644 (file)
@@ -51,8 +51,9 @@
 
 /* On Solaris 10, <sys/select.h> provides an FD_ZERO implementation
    that relies on memset(), but without including <string.h>.
-   But avoid namespace pollution on glibc systems.  */
-# ifndef __GLIBC__
+   But in any case avoid namespace pollution on glibc systems.  */
+# if (defined __sun || defined __osf__ || defined __BEOS__) \
+     && ! defined __GLIBC__
 #  include <string.h>
 # endif