changeset 4347:df44e79ce676

.h files should stand alone, but we shouldn't include <sys/types.h> if we can get away with just <stddef.h>.
author Paul Eggert <eggert@cs.ucla.edu>
date Wed, 04 Jun 2003 19:22:29 +0000
parents d83f80bb7c43
children fc8667232bcc
files lib/ChangeLog lib/__fpending.h lib/addext.c lib/backupfile.c lib/dirname.h lib/exclude.c lib/getline.c lib/hash.h lib/linebuffer.h lib/malloc.c lib/memcasecmp.c lib/memcasecmp.h lib/memcoll.c lib/memcoll.h lib/putenv.c lib/readtokens.h lib/realloc.c lib/stdio-safer.h lib/strcasecmp.c lib/version-etc.h lib/xalloc.h lib/xmemcoll.h m4/ChangeLog m4/exclude.m4
diffstat 24 files changed, 75 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,4 +1,21 @@
-2002-08-05  Paul Eggert  <eggert@twinsun.com>
+2003-06-04  Paul Eggert  <eggert@twinsun.com>
+
+	.h files should stand alone, but we shouldn't include <sys/types.h>
+	if we can get away with just <stddef.h>.
+
+	* __fpending.h, addext.c, backupfile.c, exclude.c, getline.c,
+	malloc.c, putenv.c, realloc.c, strcasecmp.c: Include <stddef.h>
+	rather than <sys/types.h>, as we merely need size_t.
+	* dirname.h, memcoll.h, xalloc.h, xmemcoll.h: Include <stddef.h>,
+	to get size_t.
+	* hash.h, linebuffer.h, readtokens.h, stdio-safer.h, version-etc.h:
+	Include <stdio.h>, to get FILE.
+	* memcasecmp.c: Don't include <sys/types.h>, as we can assume
+	memcasecmp.h has included <stddef.h> and all we need is size_t.
+	* memcoll.c: Include "memcoll.h", which gets us size_t and checks
+	our interface, instead of including <sys/types.h>
+
+2003-06-02  Paul Eggert  <eggert@twinsun.com>
 
 	[from coreutils]
 	Fix some minor time-related bugs with POSIX time arguments.
--- a/lib/__fpending.h
+++ b/lib/__fpending.h
@@ -2,14 +2,13 @@
 # include <config.h>
 #endif
 
+#include <stddef.h>
 #include <stdio.h>
 
 #if HAVE_STDIO_EXT_H
 # include <stdio_ext.h>
 #endif
 
-#include <sys/types.h>
-
 #ifndef HAVE_DECL___FPENDING
 "this configure-time declaration test was not run"
 #endif
--- a/lib/addext.c
+++ b/lib/addext.c
@@ -36,7 +36,7 @@
 # define _POSIX_NAME_MAX 14
 #endif
 
-#include <sys/types.h>
+#include <stddef.h>
 #if HAVE_STRING_H
 # include <string.h>
 #else
--- a/lib/backupfile.c
+++ b/lib/backupfile.c
@@ -25,8 +25,8 @@
 # include <config.h>
 #endif
 
+#include <stddef.h>
 #include <stdio.h>
-#include <sys/types.h>
 #if HAVE_STRING_H
 # include <string.h>
 #else
--- a/lib/dirname.h
+++ b/lib/dirname.h
@@ -17,6 +17,8 @@
 #ifndef DIRNAME_H_
 # define DIRNAME_H_ 1
 
+# include <stddef.h>
+
 # ifndef PARAMS
 #  if defined PROTOTYPES || (defined __STDC__ && __STDC__)
 #   define PARAMS(Args) Args
--- a/lib/exclude.c
+++ b/lib/exclude.c
@@ -30,10 +30,8 @@
 #ifndef errno
 extern int errno;
 #endif
+#include <stddef.h>
 #include <stdio.h>
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
 #if HAVE_STDLIB_H
 # include <stdlib.h>
 #endif
--- a/lib/getline.c
+++ b/lib/getline.c
@@ -31,8 +31,8 @@
 # define _GNU_SOURCE 1
 #endif
 
+#include <stddef.h>
 #include <stdio.h>
-#include <sys/types.h>
 
 #if defined __GNU_LIBRARY__ && HAVE_GETDELIM
 
--- a/lib/hash.h
+++ b/lib/hash.h
@@ -24,6 +24,8 @@
 #ifndef HASH_H_
 # define HASH_H_
 
+# include <stdio.h>
+
 # ifndef PARAMS
 #  if PROTOTYPES || __STDC__
 #   define PARAMS(Args) Args
--- a/lib/linebuffer.h
+++ b/lib/linebuffer.h
@@ -20,6 +20,8 @@
 #if !defined LINEBUFFER_H
 # define LINEBUFFER_H
 
+# include <stdio.h>
+
 /* A `struct linebuffer' holds a line of text. */
 
 struct linebuffer
--- a/lib/malloc.c
+++ b/lib/malloc.c
@@ -22,7 +22,7 @@
 #endif
 #undef malloc
 
-#include <sys/types.h>
+#include <stddef.h>
 
 char *malloc ();
 
--- a/lib/memcasecmp.c
+++ b/lib/memcasecmp.c
@@ -21,7 +21,6 @@
 # include <config.h>
 #endif
 
-#include <sys/types.h>
 #include <ctype.h>
 
 #if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
--- a/lib/memcasecmp.h
+++ b/lib/memcasecmp.h
@@ -1,3 +1,5 @@
+#include <stddef.h>
+
 #ifndef PARAMS
 # if defined PROTOTYPES || (defined __STDC__ && __STDC__)
 #  define PARAMS(Args) Args
--- a/lib/memcoll.c
+++ b/lib/memcoll.c
@@ -21,13 +21,13 @@
 # include <config.h>
 #endif
 
+#include "memcoll.h"
+
 #include <errno.h>
 #ifndef errno
 extern int errno;
 #endif
 
-#include <sys/types.h>
-
 #if HAVE_STRING_H
 # include <string.h>
 #endif
--- a/lib/memcoll.h
+++ b/lib/memcoll.h
@@ -5,6 +5,8 @@
 #  include <config.h>
 # endif
 
+# include <stddef.h>
+
 # ifndef PARAMS
 #  if defined PROTOTYPES || (defined __STDC__ && __STDC__)
 #   define PARAMS(Args) Args
--- a/lib/putenv.c
+++ b/lib/putenv.c
@@ -21,7 +21,7 @@
 # include <config.h>
 #endif
 
-#include <sys/types.h>
+#include <stddef.h>
 
 /* Include errno.h *after* sys/types.h to work around header problems
    on AIX 3.2.5.  */
--- a/lib/readtokens.h
+++ b/lib/readtokens.h
@@ -1,6 +1,28 @@
+/* readtokens.h -- Functions for reading tokens from an input stream.
+
+   Copyright (C) 1990, 1991, 1999, 2001, 2003 Jim Meyering.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+   Written by Jim Meyering. */
+
 #ifndef H_READTOKENS_H
 # define H_READTOKENS_H
 
+# include <stdio.h>
+
 # ifndef INITIAL_TOKEN_LENGTH
 #  define INITIAL_TOKEN_LENGTH 20
 # endif
--- a/lib/realloc.c
+++ b/lib/realloc.c
@@ -22,7 +22,7 @@
 #endif
 #undef realloc
 
-#include <sys/types.h>
+#include <stddef.h>
 
 char *malloc ();
 char *realloc ();
--- a/lib/stdio-safer.h
+++ b/lib/stdio-safer.h
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
 #ifndef PARAMS
 # if defined PROTOTYPES || (defined __STDC__ && __STDC__)
 #  define PARAMS(Args) Args
--- a/lib/strcasecmp.c
+++ b/lib/strcasecmp.c
@@ -29,7 +29,7 @@
 # define LENGTH_LIMIT_EXPR(Expr) 0
 #endif
 
-#include <sys/types.h>
+#include <stddef.h>
 #include <ctype.h>
 
 #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
--- a/lib/version-etc.h
+++ b/lib/version-etc.h
@@ -1,5 +1,5 @@
 /* Utility to help print --version output in a consistent format.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2003 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -20,6 +20,8 @@
 #ifndef VERSION_ETC_H
 # define VERSION_ETC_H 1
 
+# include <stdio.h>
+
 # ifndef PARAMS
 #  if defined PROTOTYPES || (defined __STDC__ && __STDC__)
 #   define PARAMS(Args) Args
--- a/lib/xalloc.h
+++ b/lib/xalloc.h
@@ -18,6 +18,8 @@
 #ifndef XALLOC_H_
 # define XALLOC_H_
 
+# include <stddef.h>
+
 # ifndef PARAMS
 #  if defined PROTOTYPES || (defined __STDC__ && __STDC__)
 #   define PARAMS(Args) Args
--- a/lib/xmemcoll.h
+++ b/lib/xmemcoll.h
@@ -1,2 +1,3 @@
+#include <stddef.h>
 extern int xmemcoll_exit_failure;
 int xmemcoll (char *, size_t, char *, size_t);
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -1,3 +1,8 @@
+2003-06-04  Paul Eggert  <eggert@twinsun.com>
+
+	* exclude.m4 (gl_EXCLUDE): Don't check for sys/types.h; no loner
+	needed.
+
 2003-05-30  Bruno Haible  <bruno@clisp.org>
 
 	* gettext.m4: Upgrade to gettext-0.12.1.
--- a/m4/exclude.m4
+++ b/m4/exclude.m4
@@ -9,5 +9,5 @@
 AC_DEFUN([gl_EXCLUDE],
 [
   dnl Prerequisites of lib/exclude.c.
-  AC_CHECK_HEADERS_ONCE(stdlib.h string.h strings.h sys/types.h)
+  AC_CHECK_HEADERS_ONCE(stdlib.h string.h strings.h)
 ])