summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2012-03-16 09:04:34 +0100
committerPaolo Bonzini <bonzini@gnu.org>2012-03-16 10:08:20 +0100
commitfd772887c362ff3b877ed52983bd10d9cabe8be5 (patch)
treeef90685cb6aeef6b41ee903854008bcb99bee91b
parent69b257e52cbca7e6b10b860201a54b677fe55da0 (diff)
downloadsed-fd772887c362ff3b877ed52983bd10d9cabe8be5.tar.gz
clean up header inclusions
2012-03-16 Paolo Bonzini <bonzini@gnu.org> * 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.
-rw-r--r--ChangeLog10
-rw-r--r--basicdefs.h40
-rw-r--r--sed/compile.c24
-rw-r--r--sed/execute.c42
-rw-r--r--sed/regexp.c4
-rw-r--r--sed/sed.c38
-rw-r--r--sed/sed.h3
-rw-r--r--sed/utils.c16
8 files changed, 30 insertions, 147 deletions
diff --git a/ChangeLog b/ChangeLog
index 3e8b26c..92ba840 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2012-03-16 Paolo Bonzini <bonzini@gnu.org>
+ * 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 <bonzini@gnu.org>
+
* bootstrap.sh.in: Remove.
* bootstrap.sh: Remove.
* configure.ac: Do not create bootstrap.sh.
diff --git a/basicdefs.h b/basicdefs.h
index 3d44cff..71b95fa 100644
--- a/basicdefs.h
+++ b/basicdefs.h
@@ -19,18 +19,9 @@
#define BASICDEFS_H
#include <alloca.h>
-
-#ifdef HAVE_WCHAR_H
-# include <wchar.h>
-#endif
-#ifdef HAVE_LOCALE_H
-# include <locale.h>
-#endif
-#ifdef HAVE_WCTYPE_H
-# include <wctype.h>
-#endif
-
-
+#include <wchar.h>
+#include <locale.h>
+#include <wctype.h>
#include <stdbool.h>
#include <gettext.h>
@@ -91,31 +82,6 @@ typedef unsigned long countT;
#define obstack_chunk_free ck_free
-#ifdef HAVE_MEMORY_H
-# include <memory.h>
-#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 <ctype.h> 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 <stdio.h>
#include <ctype.h>
-
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-# ifdef HAVE_MEMORY_H
-# include <memory.h>
-# endif
-#else
-# include <string.h>
-#endif /* HAVE_STRINGS_H */
-
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-#ifndef EXIT_FAILURE
-# define EXIT_FAILURE 1
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
#include <obstack.h>
diff --git a/sed/execute.c b/sed/execute.c
index 4b044c4..8f3a609 100644
--- a/sed/execute.c
+++ b/sed/execute.c
@@ -25,20 +25,18 @@
#include <stddef.h>
#include <stdio.h>
#include <ctype.h>
-
+#include <unistd.h>
#include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include "stat-macros.h"
#include <selinux/selinux.h>
#include <selinux/context.h>
#include "acl.h"
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#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 <strings.h>
-#else
-# include <string.h>
-#endif /*HAVE_STRINGS_H*/
-#ifdef HAVE_MEMORY_H
-# include <memory.h>
-#endif
-
-#ifndef HAVE_STRCHR
-# define strchr index
-# define strrchr rindex
-#endif
-
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-#ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#include <sys/stat.h>
-#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 <ctype.h>
#include <string.h>
#include <stdio.h>
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
+#include <stdlib.h>
#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 <stdio.h>
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#else
-# include <string.h>
-#endif /*HAVE_STRINGS_H*/
-#ifdef HAVE_MEMORY_H
-# include <memory.h>
-#endif
-
-#ifndef HAVE_STRCHR
-# define strchr index
-# define strrchr rindex
-#endif
-
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
#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 6d1c68a..9e22850 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 "regexp.h"
#include <stdio.h>
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 <stdio.h>
#include <stdarg.h>
#include <errno.h>
-#ifndef errno
- extern int errno;
-#endif
-
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#else
-# include <string.h>
-#endif /* HAVE_STRINGS_H */
-
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif /* HAVE_STDLIB_H */
-
+#include <string.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>