From a38f409f319ee8ec2b9f716b6ec9324e9f86fce1 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Thu, 6 Sep 2018 11:54:49 +0200 Subject: [PATCH] Remove HAVE_STRING_H The C89 standard and later defines the header as part of the standard headers [1] and on current systems it is always present. Code included also header as an alterinative in some files. This kind of check was relevant on some older systems where the file included definitions for the C89 compliant . Today such alternative check is not required anymore. The file is part of the POSIX definition these days. Current code doesn't require the files in cases of these patched files. Also Autoconf suggests doing this and relying on C89 or above [2] and [3]. [1]: https://port70.net/~nsz/c/c89/c89-draft.html#4.1.2 [2]: http://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/headers.m4 [3]: https://www.gnu.org/software/autoconf/manual/autoconf-2.69/autoconf.html --- CMakeLists.txt | 1 - configure.ac | 2 +- src/config.h.cmake.in | 3 --- src/config.h.win32 | 2 -- src/config.h.win64 | 2 -- src/config.h.windows.in | 2 -- src/regint.h | 6 +----- src/regposerr.c | 6 +----- test/test_utf8.c | 6 +----- test/testc.c | 6 +----- 10 files changed, 5 insertions(+), 31 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a4571b..323504f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,6 @@ set(HAVE_PROTOTYPES 1) check_include_files(stdarg.h HAVE_STDARG_PROTOTYPES) check_include_files(stdint.h HAVE_STDINT_H) check_include_files(strings.h HAVE_STRINGS_H) -check_include_files(string.h HAVE_STRING_H) check_include_files(sys/times.h HAVE_SYS_TIMES_H) check_include_files(sys/time.h HAVE_SYS_TIME_H) check_include_files(sys/types.h HAVE_SYS_TYPES_H) diff --git a/configure.ac b/configure.ac index 50486a9..fb72ed9 100644 --- a/configure.ac +++ b/configure.ac @@ -50,7 +50,7 @@ dnl Checks for libraries. dnl Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS(string.h strings.h sys/time.h unistd.h sys/times.h) +AC_CHECK_HEADERS(strings.h sys/time.h unistd.h sys/times.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_CHECK_SIZEOF(int, 4) diff --git a/src/config.h.cmake.in b/src/config.h.cmake.in index d51a7b7..8c4ba10 100644 --- a/src/config.h.cmake.in +++ b/src/config.h.cmake.in @@ -25,9 +25,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STRINGS_H ${HAVE_STRINGS_H} -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STRING_H ${HAVE_STRING_H} - /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_TIMES_H ${HAVE_SYS_TIMES_H} diff --git a/src/config.h.win32 b/src/config.h.win32 index f55d746..36fe268 100644 --- a/src/config.h.win32 +++ b/src/config.h.win32 @@ -1,7 +1,6 @@ #define STDC_HEADERS 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_STAT_H 1 -#define HAVE_STRING_H 1 #define HAVE_MEMORY_H 1 #define HAVE_OFF_T 1 #define SIZEOF_INT 4 @@ -25,7 +24,6 @@ #endif #define HAVE_DECL_SYS_NERR 1 #define STDC_HEADERS 1 -#define HAVE_STRING_H 1 #define HAVE_FCNTL_H 1 #define HAVE_SYS_UTIME_H 1 #define HAVE_MEMORY_H 1 diff --git a/src/config.h.win64 b/src/config.h.win64 index ca1a53b..bc2ba3e 100644 --- a/src/config.h.win64 +++ b/src/config.h.win64 @@ -1,7 +1,6 @@ #define STDC_HEADERS 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_STAT_H 1 -#define HAVE_STRING_H 1 #define HAVE_MEMORY_H 1 #define HAVE_OFF_T 1 #define SIZEOF_INT 4 @@ -25,7 +24,6 @@ #endif #define HAVE_DECL_SYS_NERR 1 #define STDC_HEADERS 1 -#define HAVE_STRING_H 1 #define HAVE_FCNTL_H 1 #define HAVE_SYS_UTIME_H 1 #define HAVE_MEMORY_H 1 diff --git a/src/config.h.windows.in b/src/config.h.windows.in index 2d5b846..160bd86 100644 --- a/src/config.h.windows.in +++ b/src/config.h.windows.in @@ -1,7 +1,6 @@ #define STDC_HEADERS 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_STAT_H 1 -#define HAVE_STRING_H 1 #define HAVE_MEMORY_H 1 #define HAVE_OFF_T 1 #define SIZEOF_INT 4 @@ -29,7 +28,6 @@ #endif #define HAVE_DECL_SYS_NERR 1 #define STDC_HEADERS 1 -#define HAVE_STRING_H 1 #define HAVE_FCNTL_H 1 #define HAVE_SYS_UTIME_H 1 #define HAVE_MEMORY_H 1 diff --git a/src/regint.h b/src/regint.h index 3d381a1..cb7cd11 100644 --- a/src/regint.h +++ b/src/regint.h @@ -163,11 +163,7 @@ #include #endif -#ifdef HAVE_STRING_H -# include -#else -# include -#endif +#include #include #ifdef HAVE_SYS_TYPES_H diff --git a/src/regposerr.c b/src/regposerr.c index 2e2a8e2..c640a81 100644 --- a/src/regposerr.c +++ b/src/regposerr.c @@ -37,11 +37,7 @@ #include "config.h" #include "onigposix.h" -#ifdef HAVE_STRING_H -# include -#else -# include -#endif +#include #if defined(__GNUC__) # define ARG_UNUSED __attribute__ ((unused)) diff --git a/test/test_utf8.c b/test/test_utf8.c index d5a966b..13a8830 100644 --- a/test/test_utf8.c +++ b/test/test_utf8.c @@ -9,11 +9,7 @@ #include "oniguruma.h" -#ifdef HAVE_STRING_H -# include -#else -# include -#endif +#include #define SLEN(s) strlen(s) diff --git a/test/testc.c b/test/testc.c index e37665a..4aa8807 100644 --- a/test/testc.c +++ b/test/testc.c @@ -10,11 +10,7 @@ #include "oniguruma.h" #endif -#ifdef HAVE_STRING_H -# include -#else -# include -#endif +#include #define SLEN(s) strlen(s) -- 2.50.1