From e299e7fce261036090d78547a91cfeb840d5a6ce Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Wed, 8 Jun 2011 20:59:56 +0200 Subject: [PATCH] headers: include-what-you-use fixes Usage of includes are set up the way found to be in use, with a help of magnificent utility. http://code.google.com/p/include-what-you-use/ Signed-off-by: Sami Kerola --- src/analyze.c | 6 +----- src/dhcpd-pools.c | 9 +++------ src/dhcpd-pools.h | 4 +++- src/getdata.c | 20 ++++++++------------ src/getopt.c | 6 +----- src/getopt1.c | 8 +------- src/other.c | 4 ++-- src/output.c | 6 +++--- src/sort.c | 8 ++------ 9 files changed, 24 insertions(+), 47 deletions(-) diff --git a/src/analyze.c b/src/analyze.c index e9bfad7..a023f98 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -15,12 +15,8 @@ ** along with this program. If not, see . */ -#ifdef HAVE_CONFIG_H -#include -#endif - +#include #include -#include #include "dhcpd-pools.h" diff --git a/src/dhcpd-pools.c b/src/dhcpd-pools.c index abcb8ca..232ed94 100644 --- a/src/dhcpd-pools.c +++ b/src/dhcpd-pools.c @@ -20,9 +20,6 @@ #endif #include -#ifdef HAVE_UNISTD_H -#include -#endif #ifdef HAVE_STDLIB_H #include #else /* Not STDC_HEADERS */ @@ -33,12 +30,12 @@ extern char *malloc(); #else #include #endif -#include -#include #include +#include +#include -#include "dhcpd-pools.h" #include "defaults.h" +#include "dhcpd-pools.h" int main(int argc, char **argv) { diff --git a/src/dhcpd-pools.h b/src/dhcpd-pools.h index fcf75b2..c43bd33 100644 --- a/src/dhcpd-pools.h +++ b/src/dhcpd-pools.h @@ -19,16 +19,18 @@ # define DHCPD_POOLS_H 1 #include +#include /* Feature test switches */ #define _POSIX_SOURCE 1 #define POSIXLY_CORRECT 1 #ifdef HAVE_STDLIB_H -#include #else extern void exit(); extern char *malloc(); +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 #endif /* STDC_HEADERS */ #ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME diff --git a/src/getdata.c b/src/getdata.c index 5456b65..215c707 100644 --- a/src/getdata.c +++ b/src/getdata.c @@ -19,10 +19,6 @@ #include #endif -#ifdef HAVE_UNISTD_H -#include -#endif - #ifdef HAVE_STDLIB_H #include #else /* Not STDC_HEADERS */ @@ -37,20 +33,20 @@ extern char *malloc(); #include #endif -#include #include +#include +#include +#include +#include +#include +#include #include -#include +#include +#include #include -#include #ifndef _XOPEN_SOURCE #define _XOPEN_SOURCE 600 #endif -#include -#include -#include -#include -#include #include "dhcpd-pools.h" #include "defaults.h" diff --git a/src/getopt.c b/src/getopt.c index 9f01d83..8f49931 100644 --- a/src/getopt.c +++ b/src/getopt.c @@ -26,9 +26,7 @@ # define _NO_PROTO #endif -#ifdef HAVE_CONFIG_H -# include -#endif +#include #if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems @@ -38,8 +36,6 @@ # endif #endif -#include - /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling diff --git a/src/getopt1.c b/src/getopt1.c index d3182d8..652ae07 100644 --- a/src/getopt1.c +++ b/src/getopt1.c @@ -17,11 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "getopt.h" +#include #if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems @@ -31,8 +27,6 @@ #endif #endif -#include - /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling diff --git a/src/other.c b/src/other.c index 7719c4e..5e887e6 100644 --- a/src/other.c +++ b/src/other.c @@ -28,9 +28,9 @@ extern void exit(); extern char *malloc(); #endif /* STDC_HEADERS */ -#include #include -#include +#include +#include #ifdef HAVE_STRING_H #include #else diff --git a/src/output.c b/src/output.c index 874efa4..86423d9 100644 --- a/src/output.c +++ b/src/output.c @@ -19,11 +19,11 @@ #include #endif -#include -#include -#include #include #include +#include +#include +#include #include "dhcpd-pools.h" diff --git a/src/sort.c b/src/sort.c index e436f5a..460f4cd 100644 --- a/src/sort.c +++ b/src/sort.c @@ -15,15 +15,11 @@ ** along with this program. If not, see . */ -#ifdef HAVE_CONFIG_H #include -#endif - +#include +#include #include -#include #include -#include -#include #include "dhcpd-pools.h" -- 1.7.10.4