bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Remove unnecessary header checks and include guards.


From: James Youngman
Subject: [PATCH] Remove unnecessary header checks and include guards.
Date: Thu, 2 Jun 2011 12:23:29 +0100

* configure.ac (AC_CHECK_HEADERS): Remove checks for header files
that gnulib either assumes are always present, or provides
itself.  These include errno.h fcntl.h inttypes.h limits.h
locale.h stddef.h stdint.h stdlib.h string.h sys/types.h
unistd.h.
* lib/buildcmd.c: Remove include guard for limits.h.
* find/fstype.c: Remove include guard for sys/types.h.
* lib/savedirinfo.c: Likewise.
* find/find.c: Remove include guard for locale.h.
* find/ftsfind.c: Likewise.
---
 ChangeLog         |   14 ++++++++++++++
 configure.ac      |    4 +---
 find/find.c       |    5 +----
 find/fstype.c     |    2 --
 find/ftsfind.c    |    6 +-----
 lib/buildcmd.c    |    6 ++----
 lib/savedirinfo.c |    8 --------
 7 files changed, 19 insertions(+), 26 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index dd8e341..bfa2c2a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2011-06-02  James Youngman  <address@hidden>
+
+       Remove unnecessary header checks and include guards.
+       * configure.ac (AC_CHECK_HEADERS): Remove checks for header files
+       that gnulib either assumes are always present, or provides
+       itself.  These include errno.h fcntl.h inttypes.h limits.h
+       locale.h stddef.h stdint.h stdlib.h string.h sys/types.h
+       unistd.h.
+       * lib/buildcmd.c: Remove include guard for limits.h.
+       * find/fstype.c: Remove include guard for sys/types.h.
+       * lib/savedirinfo.c: Likewise.
+       * find/find.c: Remove include guard for locale.h.
+       * find/ftsfind.c: Likewise.
+
 2011-06-01  James Youngman  <address@hidden>
 
        Better error handling for the result of set_fstype_devno.
diff --git a/configure.ac b/configure.ac
index 9aff8c8..c46ffc2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,15 +119,13 @@ AC_SUBST([FINDLIBS])
 
 dnl Checks for header files.
 AC_HEADER_STDC
-dnl Assume unistd.h is present - coreutils does too.
-AC_CHECK_HEADERS(fcntl.h string.h limits.h errno.h stdlib.h stddef.h)
-AC_CHECK_HEADERS(unistd.h sys/types.h inttypes.h fcntl.h locale.h stdint.h)
 AC_CHECK_HEADERS(sys/param.h mntent.h sys/mnttab.h sys/mntio.h sys/mkdev.h)
 dnl find.c needs sys/utsname.h because it calls uname(2).
 AC_CHECK_HEADERS(sys/utsname.h)
 dnl fdleak.c needs sys/resource.h because it calls getrlimit(2).
 AC_CHECK_HEADERS(sys/resource.h)
 AC_HEADER_MAJOR
+dnl TODO: it's possible gnulib eliminates the need for AC_HEADER_DIRENT.
 AC_HEADER_DIRENT
 AC_HEADER_STAT
 AC_HEADER_SYS_WAIT
diff --git a/find/find.c b/find/find.c
index 98d5a37..67da83a 100644
--- a/find/find.c
+++ b/find/find.c
@@ -37,6 +37,7 @@
 
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <locale.h>
 
 #include "fcntl--.h"
 #include "xalloc.h"
@@ -53,10 +54,6 @@
 #include "progname.h"
 #include "save-cwd.h"
 
-#ifdef HAVE_LOCALE_H
-#include <locale.h>
-#endif
-
 #if ENABLE_NLS
 # include <libintl.h>
 # define _(Text) gettext (Text)
diff --git a/find/fstype.c b/find/fstype.c
index fc8c09c..cac2d28 100644
--- a/find/fstype.c
+++ b/find/fstype.c
@@ -27,9 +27,7 @@
 #include <errno.h>
 #include <stdbool.h>
 
-#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
-#endif
 #include <sys/stat.h>
 
 /* The presence of unistd.h is assumed by gnulib these days, so we
diff --git a/find/ftsfind.c b/find/ftsfind.c
index 9fdb8ef..97fb2e4 100644
--- a/find/ftsfind.c
+++ b/find/ftsfind.c
@@ -38,10 +38,10 @@
 
 #include <errno.h>
 #include <assert.h>
+#include <locale.h>
 
 #include <fcntl.h>
 #include <sys/stat.h>
-
 #include <unistd.h>
 
 #include "progname.h"
@@ -56,10 +56,6 @@
 #include "fdleak.h"
 #include "unused-result.h"
 
-#ifdef HAVE_LOCALE_H
-#include <locale.h>
-#endif
-
 #if ENABLE_NLS
 # include <libintl.h>
 # define _(Text) gettext (Text)
diff --git a/lib/buildcmd.c b/lib/buildcmd.c
index d595e6f..0bc607c 100644
--- a/lib/buildcmd.c
+++ b/lib/buildcmd.c
@@ -23,6 +23,8 @@
 #include <wchar.h>
 #include <locale.h>
 #include <stdbool.h>
+#include <limits.h>
+
 
 #if ENABLE_NLS
 # include <libintl.h>
@@ -43,10 +45,6 @@
 #include <sys/param.h>
 #endif
 
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#endif
-
 /* The presence of unistd.h is assumed by gnulib these days, so we
  * might as well assume it too.
  */
diff --git a/lib/savedirinfo.c b/lib/savedirinfo.c
index d9b6000..f712cdb 100644
--- a/lib/savedirinfo.c
+++ b/lib/savedirinfo.c
@@ -22,16 +22,8 @@
 #include <config.h>
 
 #include <sys/stat.h>
-
-#if HAVE_SYS_TYPES_H
 # include <sys/types.h>
-#endif
-
-/* The presence of unistd.h is assumed by gnulib these days, so we
- * might as well assume it too.
- */
 #include <unistd.h>
-
 #include <errno.h>
 
 #if HAVE_DIRENT_H
-- 
1.7.2.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]