From 92295bc4b2a378893386efd3cf8cf9bc31024b59 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 4 Jun 2003 19:22:29 +0000 Subject: [PATCH] .h files should stand alone, but we shouldn't include if we can get away with just . --- lib/ChangeLog | 19 ++++++++++++++++++- lib/__fpending.h | 3 +-- lib/addext.c | 2 +- lib/backupfile.c | 2 +- lib/dirname.h | 2 ++ lib/exclude.c | 4 +--- lib/getline.c | 2 +- lib/hash.h | 2 ++ lib/linebuffer.h | 2 ++ lib/malloc.c | 2 +- lib/memcasecmp.c | 1 - lib/memcasecmp.h | 2 ++ lib/memcoll.c | 4 ++-- lib/memcoll.h | 2 ++ lib/putenv.c | 2 +- lib/readtokens.h | 22 ++++++++++++++++++++++ lib/realloc.c | 2 +- lib/stdio-safer.h | 2 ++ lib/strcasecmp.c | 2 +- lib/version-etc.h | 4 +++- lib/xalloc.h | 2 ++ lib/xmemcoll.h | 1 + m4/ChangeLog | 5 +++++ m4/exclude.m4 | 2 +- 24 files changed, 75 insertions(+), 18 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 873bd9c3d..21b402ffa 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,4 +1,21 @@ -2002-08-05 Paul Eggert +2003-06-04 Paul Eggert + + .h files should stand alone, but we shouldn't include + if we can get away with just . + + * __fpending.h, addext.c, backupfile.c, exclude.c, getline.c, + malloc.c, putenv.c, realloc.c, strcasecmp.c: Include + rather than , as we merely need size_t. + * dirname.h, memcoll.h, xalloc.h, xmemcoll.h: Include , + to get size_t. + * hash.h, linebuffer.h, readtokens.h, stdio-safer.h, version-etc.h: + Include , to get FILE. + * memcasecmp.c: Don't include , as we can assume + memcasecmp.h has included and all we need is size_t. + * memcoll.c: Include "memcoll.h", which gets us size_t and checks + our interface, instead of including + +2003-06-02 Paul Eggert [from coreutils] Fix some minor time-related bugs with POSIX time arguments. diff --git a/lib/__fpending.h b/lib/__fpending.h index a59bc58d5..5a5158216 100644 --- a/lib/__fpending.h +++ b/lib/__fpending.h @@ -2,14 +2,13 @@ # include #endif +#include #include #if HAVE_STDIO_EXT_H # include #endif -#include - #ifndef HAVE_DECL___FPENDING "this configure-time declaration test was not run" #endif diff --git a/lib/addext.c b/lib/addext.c index 283756bf4..7753c608a 100644 --- a/lib/addext.c +++ b/lib/addext.c @@ -36,7 +36,7 @@ # define _POSIX_NAME_MAX 14 #endif -#include +#include #if HAVE_STRING_H # include #else diff --git a/lib/backupfile.c b/lib/backupfile.c index 0dfa02eac..d78ce3945 100644 --- a/lib/backupfile.c +++ b/lib/backupfile.c @@ -25,8 +25,8 @@ # include #endif +#include #include -#include #if HAVE_STRING_H # include #else diff --git a/lib/dirname.h b/lib/dirname.h index cea14c04f..4f794ee48 100644 --- a/lib/dirname.h +++ b/lib/dirname.h @@ -17,6 +17,8 @@ #ifndef DIRNAME_H_ # define DIRNAME_H_ 1 +# include + # ifndef PARAMS # if defined PROTOTYPES || (defined __STDC__ && __STDC__) # define PARAMS(Args) Args diff --git a/lib/exclude.c b/lib/exclude.c index 9f2970f4b..fb735ee6e 100644 --- a/lib/exclude.c +++ b/lib/exclude.c @@ -30,10 +30,8 @@ #ifndef errno extern int errno; #endif +#include #include -#if HAVE_SYS_TYPES_H -# include -#endif #if HAVE_STDLIB_H # include #endif diff --git a/lib/getline.c b/lib/getline.c index 18383b12c..f4edecc8a 100644 --- a/lib/getline.c +++ b/lib/getline.c @@ -31,8 +31,8 @@ # define _GNU_SOURCE 1 #endif +#include #include -#include #if defined __GNU_LIBRARY__ && HAVE_GETDELIM diff --git a/lib/hash.h b/lib/hash.h index a9fc18760..b5537fa8d 100644 --- a/lib/hash.h +++ b/lib/hash.h @@ -24,6 +24,8 @@ #ifndef HASH_H_ # define HASH_H_ +# include + # ifndef PARAMS # if PROTOTYPES || __STDC__ # define PARAMS(Args) Args diff --git a/lib/linebuffer.h b/lib/linebuffer.h index aa6db0e3f..b91bf7813 100644 --- a/lib/linebuffer.h +++ b/lib/linebuffer.h @@ -20,6 +20,8 @@ #if !defined LINEBUFFER_H # define LINEBUFFER_H +# include + /* A `struct linebuffer' holds a line of text. */ struct linebuffer diff --git a/lib/malloc.c b/lib/malloc.c index 5e7674bd4..bcd6b564b 100644 --- a/lib/malloc.c +++ b/lib/malloc.c @@ -22,7 +22,7 @@ #endif #undef malloc -#include +#include char *malloc (); diff --git a/lib/memcasecmp.c b/lib/memcasecmp.c index 18dd31f6e..3b2d83898 100644 --- a/lib/memcasecmp.c +++ b/lib/memcasecmp.c @@ -21,7 +21,6 @@ # include #endif -#include #include #if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) diff --git a/lib/memcasecmp.h b/lib/memcasecmp.h index 164dff435..61c39aa73 100644 --- a/lib/memcasecmp.h +++ b/lib/memcasecmp.h @@ -1,3 +1,5 @@ +#include + #ifndef PARAMS # if defined PROTOTYPES || (defined __STDC__ && __STDC__) # define PARAMS(Args) Args diff --git a/lib/memcoll.c b/lib/memcoll.c index 49eccdad2..2bb33fdfc 100644 --- a/lib/memcoll.c +++ b/lib/memcoll.c @@ -21,13 +21,13 @@ # include #endif +#include "memcoll.h" + #include #ifndef errno extern int errno; #endif -#include - #if HAVE_STRING_H # include #endif diff --git a/lib/memcoll.h b/lib/memcoll.h index 4909bddff..b42cfa6f2 100644 --- a/lib/memcoll.h +++ b/lib/memcoll.h @@ -5,6 +5,8 @@ # include # endif +# include + # ifndef PARAMS # if defined PROTOTYPES || (defined __STDC__ && __STDC__) # define PARAMS(Args) Args diff --git a/lib/putenv.c b/lib/putenv.c index 58a498fda..239981f07 100644 --- a/lib/putenv.c +++ b/lib/putenv.c @@ -21,7 +21,7 @@ # include #endif -#include +#include /* Include errno.h *after* sys/types.h to work around header problems on AIX 3.2.5. */ diff --git a/lib/readtokens.h b/lib/readtokens.h index a2e0b9d73..0fb8b463b 100644 --- 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 + # ifndef INITIAL_TOKEN_LENGTH # define INITIAL_TOKEN_LENGTH 20 # endif diff --git a/lib/realloc.c b/lib/realloc.c index d0d3e4ab0..5c94a0a25 100644 --- a/lib/realloc.c +++ b/lib/realloc.c @@ -22,7 +22,7 @@ #endif #undef realloc -#include +#include char *malloc (); char *realloc (); diff --git a/lib/stdio-safer.h b/lib/stdio-safer.h index bd5cbd8da..20fabd3ef 100644 --- a/lib/stdio-safer.h +++ b/lib/stdio-safer.h @@ -1,3 +1,5 @@ +#include + #ifndef PARAMS # if defined PROTOTYPES || (defined __STDC__ && __STDC__) # define PARAMS(Args) Args diff --git a/lib/strcasecmp.c b/lib/strcasecmp.c index ae7601de0..cf4ab88db 100644 --- a/lib/strcasecmp.c +++ b/lib/strcasecmp.c @@ -29,7 +29,7 @@ # define LENGTH_LIMIT_EXPR(Expr) 0 #endif -#include +#include #include #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) diff --git a/lib/version-etc.h b/lib/version-etc.h index ae223d44e..4b1a7d9c8 100644 --- 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 + # ifndef PARAMS # if defined PROTOTYPES || (defined __STDC__ && __STDC__) # define PARAMS(Args) Args diff --git a/lib/xalloc.h b/lib/xalloc.h index 098a6c2e0..5b623da20 100644 --- a/lib/xalloc.h +++ b/lib/xalloc.h @@ -18,6 +18,8 @@ #ifndef XALLOC_H_ # define XALLOC_H_ +# include + # ifndef PARAMS # if defined PROTOTYPES || (defined __STDC__ && __STDC__) # define PARAMS(Args) Args diff --git a/lib/xmemcoll.h b/lib/xmemcoll.h index dfda0fce9..1b1a193ee 100644 --- a/lib/xmemcoll.h +++ b/lib/xmemcoll.h @@ -1,2 +1,3 @@ +#include extern int xmemcoll_exit_failure; int xmemcoll (char *, size_t, char *, size_t); diff --git a/m4/ChangeLog b/m4/ChangeLog index 572eca7ee..6c397347d 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,8 @@ +2003-06-04 Paul Eggert + + * exclude.m4 (gl_EXCLUDE): Don't check for sys/types.h; no loner + needed. + 2003-05-30 Bruno Haible * gettext.m4: Upgrade to gettext-0.12.1. diff --git a/m4/exclude.m4 b/m4/exclude.m4 index 4ec93de64..0501fc426 100644 --- a/m4/exclude.m4 +++ b/m4/exclude.m4 @@ -9,5 +9,5 @@ dnl the same distribution terms as the rest of that program. 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) ]) -- 2.11.0