[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Remove unnecessary include guards.
From: |
James Youngman |
Subject: |
[PATCH] Remove unnecessary include guards. |
Date: |
Tue, 10 Mar 2009 23:54:42 +0000 |
Remove "lib/wait.h", since gnulib provides <sys/wait.h>.
* lib/Makefile.am (EXTRA_DIST): Remove wait.h, since gnulib
provides it.
* lib/wait.h: Not needed.
* find/pred.c: Include <sys/wait.h> instead of "wait.h".
* lib/waitpid.c: Likewise.
* xargs/xargs.c: Likewise.
Remove unnecessary include guards.
* lib/dircallback.c: gnulib provides <locale.h>, so no need for
include guards.
* locate/locate.c: Likewise.
* lib/listfile.c: Likewise.
* lib/savedirinfo.c: Likewise with <sys/stat.h>
* find/defs.h: gnulib provides <inttypes.h>, so no need for
include guards.
* lib/nextelem.c: Likewise with <string.h> and <stdlib.h>.
* locate/bigram.c: Likewise.
* locate/frcode.c: Likewise.
* lib/buildcmd.c: Likewise with <locale.h> and <wchar.h>
* xargs/xargs.c: Likewise with <locale.h>, <wchar.h> and <stdlib.h>
* import-gnulib.config (modules): Import the mbrtowc and whchar
modules.
* lib/qmark.c (multibyte_qmark_chars): Don't surround with
HAVE_MBRTOWC, since we now have a replacement for mbrtowc.
Likewise, don't protect inclusion of <string.h> with
HAVE_STRING_H. Likewise with <wchar.h>.
(multibyte_qmark_chars): Rename to qmark_chars.
(qmark_chars): Remove old version (since it is replaced by the
function that used to be multibyte_qmark_chars).
* lib/printquoted.c: Don't include <wchar.h>, we don't need it.
Signed-off-by: James Youngman <address@hidden>
---
ChangeLog | 32 +++++++++++++++++++++++++++++
find/defs.h | 3 +-
find/pred.c | 2 +-
import-gnulib.config | 2 +
lib/Makefile.am | 2 +-
lib/buildcmd.c | 16 +------------
lib/dircallback.c | 5 +---
lib/listfile.c | 6 +----
lib/nextelem.c | 10 +--------
lib/printquoted.c | 8 +------
lib/qmark.c | 55 +++++++++++++++----------------------------------
lib/savedirinfo.c | 4 +--
lib/wait.h | 40 ------------------------------------
lib/waitpid.c | 2 +-
locate/bigram.c | 10 +-------
locate/frcode.c | 9 +-------
locate/locate.c | 4 +--
xargs/xargs.c | 37 +++------------------------------
18 files changed, 70 insertions(+), 177 deletions(-)
delete mode 100644 lib/wait.h
diff --git a/ChangeLog b/ChangeLog
index 05b90a7..8053097 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,37 @@
2009-03-10 James Youngman <address@hidden>
+ Remove "lib/wait.h", since gnulib provides <sys/wait.h>.
+ * lib/Makefile.am (EXTRA_DIST): Remove wait.h, since gnulib
+ provides it.
+ * lib/wait.h: Not needed.
+ * find/pred.c: Include <sys/wait.h> instead of "wait.h".
+ * lib/waitpid.c: Likewise.
+ * xargs/xargs.c: Likewise.
+
+ Remove unnecessary include guards.
+ * lib/dircallback.c: gnulib provides <locale.h>, so no need for
+ include guards.
+ * locate/locate.c: Likewise.
+ * lib/listfile.c: Likewise.
+ * lib/savedirinfo.c: Likewise with <sys/stat.h>
+ * find/defs.h: gnulib provides <inttypes.h>, so no need for
+ include guards.
+ * lib/nextelem.c: Likewise with <string.h> and <stdlib.h>.
+ * locate/bigram.c: Likewise.
+ * locate/frcode.c: Likewise.
+ * lib/buildcmd.c: Likewise with <locale.h> and <wchar.h>
+ * xargs/xargs.c: Likewise with <locale.h>, <wchar.h> and <stdlib.h>
+ * import-gnulib.config (modules): Import the mbrtowc and whchar
+ modules.
+ * lib/qmark.c (multibyte_qmark_chars): Don't surround with
+ HAVE_MBRTOWC, since we now have a replacement for mbrtowc.
+ Likewise, don't protect inclusion of <string.h> with
+ HAVE_STRING_H. Likewise with <wchar.h>.
+ (multibyte_qmark_chars): Rename to qmark_chars.
+ (qmark_chars): Remove old version (since it is replaced by the
+ function that used to be multibyte_qmark_chars).
+ * lib/printquoted.c: Don't include <wchar.h>, we don't need it.
+
Prepare for release of findutils-4.5.4.
* configure.ac (AC_INIT): Set version number to 4.5.4.
* NEWS: Likewise.
diff --git a/find/defs.h b/find/defs.h
index c6fcc0f..c5db979 100644
--- a/find/defs.h
+++ b/find/defs.h
@@ -55,9 +55,8 @@ Please stop compiling the program now
# define CHAR_BIT 8
#endif
-#if HAVE_INTTYPES_H
# include <inttypes.h>
-#endif
+
typedef bool boolean;
#include "regex.h"
diff --git a/find/pred.c b/find/pred.c
index 142936b..c168fc9 100644
--- a/find/pred.c
+++ b/find/pred.c
@@ -38,7 +38,6 @@
#include "human.h"
#include "modetype.h"
#include "filemode.h"
-#include "wait.h"
#include "printquoted.h"
#include "buildcmd.h"
#include "yesno.h"
@@ -66,6 +65,7 @@
#endif
+#include <sys/wait.h>
#if HAVE_DIRENT_H
# include <dirent.h>
diff --git a/import-gnulib.config b/import-gnulib.config
index cf9912e..0db72cf 100644
--- a/import-gnulib.config
+++ b/import-gnulib.config
@@ -51,6 +51,7 @@ inline
inttypes
lstat
malloc
+mbrtowc
mbscasestr
mbsstr
mktime
@@ -80,6 +81,7 @@ verify
version-etc
version-etc-fsf
warnings
+wchar
wcwidth
xalloc
xalloc-die
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 3fbc39d..b388b74 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -15,7 +15,7 @@ regexprops_SOURCES = regexprops.c regextype.c
endif
libfind_a_SOURCES = gnulib-version.c findutils-version.c
-EXTRA_DIST = modetype.h wait.h extendbuf.h savedirinfo.h buildcmd.h \
+EXTRA_DIST = modetype.h extendbuf.h savedirinfo.h buildcmd.h \
gnulib-version.h gnulib-version.c findutils-version.h
BUILT_SOURCES = gnulib-version.c
SUFFIXES =
diff --git a/lib/buildcmd.c b/lib/buildcmd.c
index bc51bb6..9c8339d 100644
--- a/lib/buildcmd.c
+++ b/lib/buildcmd.c
@@ -50,21 +50,9 @@
# endif
#include <string.h>
-
-
-#if DO_MULTIBYTE
-# if HAVE_MBRLEN
-# include <wchar.h>
-# else
- /* Simulate mbrlen with mblen as best we can. */
-# define mbstate_t int
-# define mbrlen(s, n, ps) mblen (s, n)
-# endif
-#endif
-
-#ifdef HAVE_LOCALE_H
+#include <wchar.h>
#include <locale.h>
-#endif
+
#if ENABLE_NLS
# include <libintl.h>
# define _(Text) gettext (Text)
diff --git a/lib/dircallback.c b/lib/dircallback.c
index 94ace95..aa5ecc5 100644
--- a/lib/dircallback.c
+++ b/lib/dircallback.c
@@ -27,15 +27,12 @@
#include <stddef.h>
#include <errno.h>
#include <sys/stat.h>
+#include <locale.h>
#include "fcntl--.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/lib/listfile.c b/lib/listfile.c
index 48c7f4a..e898979 100644
--- a/lib/listfile.c
+++ b/lib/listfile.c
@@ -32,6 +32,7 @@
#include <string.h>
#include <unistd.h> /* for readlink() */
#include <openat.h>
+#include <locale.h>
#include "human.h"
#include "xalloc.h"
@@ -56,11 +57,6 @@
-
-#ifdef HAVE_LOCALE_H
-#include <locale.h>
-#endif
-
#if ENABLE_NLS
# include <libintl.h>
# define _(Text) gettext (Text)
diff --git a/lib/nextelem.c b/lib/nextelem.c
index b785453..7367b08 100644
--- a/lib/nextelem.c
+++ b/lib/nextelem.c
@@ -22,17 +22,9 @@
#include <stdio.h>
-#if defined HAVE_STRING_H || defined STDC_HEADERS
#include <string.h>
-#else
-#include <strings.h>
-#ifndef strchr
-#define strchr index
-#endif
-#endif
-#if defined STDC_HEADERS
#include <stdlib.h>
-#endif
+
#include "nextelem.h"
diff --git a/lib/printquoted.c b/lib/printquoted.c
index 4d78262..1868f82 100644
--- a/lib/printquoted.c
+++ b/lib/printquoted.c
@@ -1,7 +1,7 @@
/* printquoted.c -- print a specified string with any necessary quoting.
Copyright (C) 1990, 1991, 1992, 1993, 1994, 2000,
- 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2007, 2009 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
@@ -24,12 +24,6 @@
#include <stdlib.h>
#include <stdio.h>
-/* Get mbstate_t, mbrtowc(), mbsinit(), wcwidth(). */
-#if HAVE_WCHAR_H
-# include <wchar.h>
-#endif
-
-
#include "xalloc.h"
#include "printquoted.h"
diff --git a/lib/qmark.c b/lib/qmark.c
index 2e3bb49..1f31c3b 100644
--- a/lib/qmark.c
+++ b/lib/qmark.c
@@ -1,6 +1,6 @@
/* qmark.c -- quote 'dangerous' filenames
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
Derived from courutils' ls.c:
Copyright (C) 85, 88, 90, 91, 1995-2005 Free Software Foundation, Inc.
@@ -20,25 +20,16 @@
#include <config.h>
-# include <stddef.h>
-# include <stdlib.h>
+#include <stddef.h>
+#include <stdlib.h>
#include <ctype.h>
-
-#if HAVE_STRING_H || STDC_HEADERS
#include <string.h>
-#else
-#include <strings.h>
-#endif
-
-
-/* Get mbstate_t, mbrtowc(), mbsinit(), wcwidth(). */
-#if HAVE_WCHAR_H
-# include <wchar.h>
-#endif
+#include <wchar.h>
#include "printquoted.h"
+
/*
This comment, IN_CTYPE_DOMAIN and ISPRINT were borrowed from
coreutils at Sun Jun 5 21:17:40 2005 UTC.
@@ -92,7 +83,6 @@ static inline unsigned char to_uchar (char ch)
}
-
static size_t
unibyte_qmark_chars(char *buf, size_t len)
{
@@ -109,9 +99,18 @@ unibyte_qmark_chars(char *buf, size_t len)
}
-#if HAVE_MBRTOWC
-static size_t
-multibyte_qmark_chars(char *buf, size_t len)
+
+
+
+/* Scan BUF, replacing any dangerous-looking characters with question
+ * marks. This code is taken from the ls.c file in coreutils as at
+ * Sun Jun 5 20:51:54 2005 UTC.
+ *
+ * This function may shrink the buffer. Either way, the new length
+ * is returned.
+ */
+size_t
+qmark_chars(char *buf, size_t len)
{
if (MB_CUR_MAX <= 1)
{
@@ -215,23 +214,3 @@ multibyte_qmark_chars(char *buf, size_t len)
return len;
}
}
-#endif
-
-
-/* Scan BUF, replacing any dangerous-looking characters with question
- * marks. This code is taken from the ls.c file in coreutils as at
- * Sun Jun 5 20:51:54 2005 UTC.
- *
- * This function may shrink the buffer. Either way, the new length
- * is returned.
- */
-size_t
-qmark_chars(char *buf, size_t len)
-{
-#if HAVE_MBRTOWC
- return multibyte_qmark_chars(buf, len);
-#else
- return unibyte_qmark_chars(buf, len);
-#endif
-}
-
diff --git a/lib/savedirinfo.c b/lib/savedirinfo.c
index c3c5f92..6140681 100644
--- a/lib/savedirinfo.c
+++ b/lib/savedirinfo.c
@@ -21,9 +21,7 @@
#include <config.h>
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
+#include <sys/stat.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
diff --git a/lib/wait.h b/lib/wait.h
deleted file mode 100644
index 135ea2d..0000000
--- a/lib/wait.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* wait.h -- POSIX macros for evaluating exit statuses
- Copyright (C) 1990 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
- the Free Software Foundation, either version 3 of the License, 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, see <http://www.gnu.org/licenses/>.
-*/
-#include <sys/types.h> /* For pid_t. */
-#if HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-
-#ifndef WIFSTOPPED
-#define WIFSTOPPED(w) (((w) & 0xff) == 0x7f)
-#endif
-#ifndef WIFSIGNALED
-#define WIFSIGNALED(w) (((w) & 0xff) != 0x7f && ((w) & 0xff) != 0)
-#endif
-#ifndef WIFEXITED
-#define WIFEXITED(w) (((w) & 0xff) == 0)
-#endif
-
-#ifndef WSTOPSIG
-#define WSTOPSIG(w) (((w) >> 8) & 0xff)
-#endif
-#ifndef WTERMSIG
-#define WTERMSIG(w) ((w) & 0x7f)
-#endif
-#ifndef WEXITSTATUS
-#define WEXITSTATUS(w) (((w) >> 8) & 0xff)
-#endif
diff --git a/lib/waitpid.c b/lib/waitpid.c
index 16d8358..9916ffc 100644
--- a/lib/waitpid.c
+++ b/lib/waitpid.c
@@ -28,7 +28,7 @@ extern int errno;
#include <process.h>
#else
/* Unix API. */
-#include "wait.h"
+#include <sys/wait.h>
#endif
#define WAITPID_CHILDREN 8
diff --git a/locate/bigram.c b/locate/bigram.c
index 70b93dc..d3a6d1c 100644
--- a/locate/bigram.c
+++ b/locate/bigram.c
@@ -1,5 +1,5 @@
/* bigram -- list bigrams for locate
- Copyright (C) 1994, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1994, 2007, 2009 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
@@ -32,15 +32,9 @@
#include <config.h>
#include <stdio.h>
-#if defined HAVE_STRING_H || defined STDC_HEADERS
#include <string.h>
-#else
-#include <strings.h>
-#endif
-
-#ifdef STDC_HEADERS
#include <stdlib.h>
-#endif
+
#include <sys/types.h>
#include <xalloc.h>
diff --git a/locate/frcode.c b/locate/frcode.c
index 23f9369..b65c606 100644
--- a/locate/frcode.c
+++ b/locate/frcode.c
@@ -71,16 +71,9 @@
#include <errno.h>
#include <sys/types.h>
#include <stdbool.h>
-
-#if defined HAVE_STRING_H || defined STDC_HEADERS
#include <string.h>
-#else
-#include <strings.h>
-#endif
-
-#ifdef STDC_HEADERS
#include <stdlib.h>
-#endif
+
#if ENABLE_NLS
# include <libintl.h>
diff --git a/locate/locate.c b/locate/locate.c
index a8d980f..c01f6c2 100644
--- a/locate/locate.c
+++ b/locate/locate.c
@@ -91,10 +91,8 @@
#endif
#include <errno.h>
-
-#ifdef HAVE_LOCALE_H
#include <locale.h>
-#endif
+
#if ENABLE_NLS
# include <libintl.h>
diff --git a/xargs/xargs.c b/xargs/xargs.c
index d3b1969..713dc54 100644
--- a/xargs/xargs.c
+++ b/xargs/xargs.c
@@ -85,28 +85,21 @@
* might as well assume it too.
*/
#include <unistd.h>
-
#include <signal.h>
+#include <sys/wait.h>
+#include <stdlib.h>
+#include <locale.h>
+#include <wchar.h>
#if !defined(SIGCHLD) && defined(SIGCLD)
#define SIGCHLD SIGCLD
#endif
#include "verify.h"
-#include "wait.h"
#include "quotearg.h"
#include "findutils-version.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#else
-extern int errno;
-#endif
-
-#ifdef HAVE_LOCALE_H
-#include <locale.h>
-#endif
#if ENABLE_NLS
# include <libintl.h>
# define _(Text) gettext (Text)
@@ -128,28 +121,6 @@ extern int errno;
/* Return nonzero if S is the EOF string. */
#define EOF_STR(s) (eof_str && *eof_str == *s && !strcmp (eof_str, s))
-/* Do multibyte processing if multibyte characters are supported,
- unless multibyte sequences are search safe. Multibyte sequences
- are search safe if searching for a substring using the byte
- comparison function 'strstr' gives no false positives. All 8-bit
- encodings and the UTF-8 multibyte encoding are search safe, but
- the EUC encodings are not.
- BeOS uses the UTF-8 encoding exclusively, so it is search safe. */
-#if defined __BEOS__
-# define MULTIBYTE_IS_SEARCH_SAFE 1
-#endif
-#define DO_MULTIBYTE (HAVE_MBLEN && ! MULTIBYTE_IS_SEARCH_SAFE)
-
-#if DO_MULTIBYTE
-# if HAVE_MBRLEN
-# include <wchar.h>
-# else
- /* Simulate mbrlen with mblen as best we can. */
-# define mbstate_t int
-# define mbrlen(s, n, ps) mblen (s, n)
-# endif
-#endif
-
/* Not char because of type promotion; NeXT gcc can't handle it. */
typedef int boolean;
#define true 1
--
1.5.6.5
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Remove unnecessary include guards.,
James Youngman <=