From 9ea38da9fbeda4ca2d8cdc4bc5ede2202d3ff34e Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 16 Mar 2012 09:04:34 +0100 Subject: [PATCH] clean up header inclusions 2012-03-16 Paolo Bonzini * basicdefs.h: Enjoy gnulib's headers. * sed/compile.c: Likewise. * sed/execute.c: Likewise. * sed/regexp.c: Likewise. * sed/sed.c: Likewise. * sed/sed.h: Likewise. * sed/utils.c: Likewise. --- ChangeLog | 10 ++++++++++ basicdefs.h | 40 +++------------------------------------- sed/compile.c | 24 +++--------------------- sed/execute.c | 42 ++++++------------------------------------ sed/regexp.c | 4 +--- sed/sed.c | 38 +++++--------------------------------- sed/sed.h | 3 --- sed/utils.c | 16 ++-------------- 8 files changed, 30 insertions(+), 147 deletions(-) diff --git a/ChangeLog b/ChangeLog index bd00f81..7888e6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2012-03-16 Paolo Bonzini + + * basicdefs.h: Enjoy gnulib's headers. + * sed/compile.c: Likewise. + * sed/execute.c: Likewise. + * sed/regexp.c: Likewise. + * sed/sed.c: Likewise. + * sed/sed.h: Likewise. + * sed/utils.c: Likewise. + 2012-03-16 Paolo Bonzini * bootstrap.sh.in: Remove. diff --git a/basicdefs.h b/basicdefs.h index 0d1db78..9d18322 100644 --- a/basicdefs.h +++ b/basicdefs.h @@ -19,18 +19,9 @@ #define BASICDEFS_H #include - -#ifdef HAVE_WCHAR_H -# include -#endif -#ifdef HAVE_LOCALE_H -# include -#endif -#ifdef HAVE_WCTYPE_H -# include -#endif - - +#include +#include +#include #include #include @@ -91,31 +82,6 @@ typedef unsigned long countT; #define obstack_chunk_free ck_free -#ifdef HAVE_MEMORY_H -# include -#endif - -#ifndef HAVE_MEMMOVE -# ifndef memmove - /* ../lib/libsed.a provides a memmove() if the system doesn't. - Here is where we declare its return type; we don't prototype - it because that sometimes causes problems when we're running in - bootstrap mode on a system which really does support memmove(). */ - extern VOID *memmove(); -# endif -#endif - -#ifndef HAVE_MEMCPY -# ifndef memcpy -# define memcpy(d, s, n) memmove(d, s, n) -# endif -#endif - -#ifndef HAVE_STRERROR - extern char *strerror P_((int e)); -#endif - - /* handle misdesigned macros (snarfed from lib/regex.c) */ /* Jim Meyering writes: diff --git a/sed/compile.c b/sed/compile.c index d71e67d..cf3b32b 100644 --- a/sed/compile.c +++ b/sed/compile.c @@ -21,27 +21,9 @@ #include "sed.h" #include #include - -#ifdef HAVE_STRINGS_H -# include -# ifdef HAVE_MEMORY_H -# include -# endif -#else -# include -#endif /* HAVE_STRINGS_H */ - -#ifdef HAVE_STDLIB_H -# include -#endif -#ifndef EXIT_FAILURE -# define EXIT_FAILURE 1 -#endif - -#ifdef HAVE_SYS_TYPES_H -# include -#endif - +#include +#include +#include #include diff --git a/sed/execute.c b/sed/execute.c index 3432602..8d0f5e1 100644 --- a/sed/execute.c +++ b/sed/execute.c @@ -25,20 +25,18 @@ #include #include #include - +#include #include -#ifndef errno -extern int errno; -#endif +#include +#include +#include +#include +#include "stat-macros.h" #include #include #include "acl.h" -#ifdef HAVE_UNISTD_H -# include -#endif - #ifdef __GNUC__ # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__-0 >= 7) /* silence warning about unused parameter even for "gcc -W -Wunused" */ @@ -49,34 +47,6 @@ extern int errno; # define UNUSED #endif -#ifdef HAVE_STRINGS_H -# include -#else -# include -#endif /*HAVE_STRINGS_H*/ -#ifdef HAVE_MEMORY_H -# include -#endif - -#ifndef HAVE_STRCHR -# define strchr index -# define strrchr rindex -#endif - -#ifdef HAVE_STDLIB_H -# include -#endif -#ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -#endif - -#ifdef HAVE_SYS_TYPES_H -# include -#endif - -#include -#include "stat-macros.h" - /* Sed operates a line at a time. */ struct line { diff --git a/sed/regexp.c b/sed/regexp.c index 39914de..74cee00 100644 --- a/sed/regexp.c +++ b/sed/regexp.c @@ -21,9 +21,7 @@ #include #include #include -#ifdef HAVE_STDLIB_H -# include -#endif +#include #ifdef gettext_noop # define N_(String) gettext_noop(String) diff --git a/sed/sed.c b/sed/sed.c index e0d5771..a01ab42 100644 --- a/sed/sed.c +++ b/sed/sed.c @@ -21,41 +21,13 @@ #include -#ifdef HAVE_STRINGS_H -# include -#else -# include -#endif /*HAVE_STRINGS_H*/ -#ifdef HAVE_MEMORY_H -# include -#endif - -#ifndef HAVE_STRCHR -# define strchr index -# define strrchr rindex -#endif - -#ifdef HAVE_STDLIB_H -# include -#endif - -#ifdef HAVE_SYS_TYPES_H -# include -#endif +#include +#include +#include #include "getopt.h" #include "version-etc.h" -#ifndef HAVE_STDLIB_H - extern char *getenv P_((const char *)); -#endif - -#ifndef HAVE_STRTOUL -# define ATOI(x) atoi(x) -#else -# define ATOI(x) strtoul(x, NULL, 0) -#endif - #define AUTHORS \ _("Jay Fenlason"), \ _("Tom Lord"), \ @@ -246,7 +218,7 @@ main(argc, argv) */ if (cols) { - countT t = ATOI(cols); + countT t = atoi(cols); if (t > 1) lcmd_out_line_len = t-1; } @@ -293,7 +265,7 @@ main(argc, argv) break; case 'l': - lcmd_out_line_len = ATOI(optarg); + lcmd_out_line_len = atoi(optarg); break; case 'p': diff --git a/sed/sed.h b/sed/sed.h index 29a9495..2cbf47e 100644 --- a/sed/sed.h +++ b/sed/sed.h @@ -16,10 +16,7 @@ along with this program; if not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif - #include "basicdefs.h" #include "regex.h" #include diff --git a/sed/utils.c b/sed/utils.c index cb29b87..3db737b 100644 --- a/sed/utils.c +++ b/sed/utils.c @@ -21,20 +21,8 @@ #include #include #include -#ifndef errno - extern int errno; -#endif - -#ifdef HAVE_STRINGS_H -# include -#else -# include -#endif /* HAVE_STRINGS_H */ - -#ifdef HAVE_STDLIB_H -# include -#endif /* HAVE_STDLIB_H */ - +#include +#include #include #include #include