changeset 13773:d06d8f66d2bd

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.
author Bruno Haible <bruno@clisp.org>
date Thu, 07 Oct 2010 00:52:15 +0200
parents 1d8a613275c6
children e53ef64052ed
files ChangeLog lib/string.in.h lib/sys_select.in.h
diffstat 3 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Oct 05 16:39:32 2010 -0600
+++ b/ChangeLog	Thu Oct 07 00:52:15 2010 +0200
@@ -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
--- a/lib/string.in.h	Tue Oct 05 16:39:32 2010 -0600
+++ b/lib/string.in.h	Thu Oct 07 00:52:15 2010 +0200
@@ -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
--- a/lib/sys_select.in.h	Tue Oct 05 16:39:32 2010 -0600
+++ b/lib/sys_select.in.h	Thu Oct 07 00:52:15 2010 +0200
@@ -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