]> granicus.if.org Git - php/commitdiff
Remove HAVE_STRING_H
authorPeter Kokot <peterkokot@gmail.com>
Sat, 15 Sep 2018 23:14:08 +0000 (01:14 +0200)
committerPeter Kokot <peterkokot@gmail.com>
Tue, 18 Sep 2018 03:32:08 +0000 (05:32 +0200)
The C89 standard and later defines the `<string.h>` header as part of
the standard headers [1] and on current systems it is always present.

Code included also `<strings.h>` header as an alterinative in some
files. This kind of check was relevant on some older systems where the
`<strings.h>` file included definitions for the C89 compliant
`<string.h>`. Today such alternative check is not required anymore. The
`<strings.h>` file is part of the POSIX definition these days.

Also Autoconf suggests doing this and relying on C89 or above [2] and [3].

This patch also cleans few unused `<strings.h>` inclusions in the libmbfl.

[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

21 files changed:
Zend/Zend.m4
Zend/configure.ac
configure.ac
ext/mbstring/config.m4
ext/mbstring/libmbfl/config.h.in
ext/mbstring/libmbfl/config.h.w32
ext/mbstring/libmbfl/filters/mbfilter_htmlent.c
ext/mbstring/libmbfl/mbfl/mbfilter.c
ext/mbstring/libmbfl/mbfl/mbfl_allocators.c
ext/mbstring/libmbfl/mbfl/mbfl_encoding.c
ext/mbstring/libmbfl/mbfl/mbfl_language.c
ext/standard/array.c
ext/standard/basic_functions.c
ext/standard/crypt.c
ext/standard/crypt_sha256.c
ext/standard/crypt_sha512.c
ext/standard/dl.c
ext/xmlrpc/libxmlrpc/acinclude.m4
main/alloca.c
main/php_scandir.c
win32/build/config.w32.h.in

index 8b7971eea1ddeb6a9a171129806ab7c4cde28b97..55a98d6ff3ed3c62fe4edb61ad2f0c436a53b201 100644 (file)
@@ -50,7 +50,6 @@ inttypes.h \
 stdint.h \
 limits.h \
 malloc.h \
-string.h \
 unistd.h \
 stdarg.h \
 sys/types.h \
index 5b88ff0ead05675a285eaccae3ac00e6671cf6a3..8252cfb3426ab695d6dcb6acb8d71594cd27372f 100644 (file)
@@ -42,11 +42,7 @@ AH_BOTTOM([
 # include <ieeefp.h>
 #endif
 
-#ifdef HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-#endif
+#include <string.h>
 
 #if ZEND_BROKEN_SPRINTF
 int zend_sprintf(char *buffer, const char *format, ...);
index a07ee1399b2b0b4131b5651dae08386b05783032..b5d413a5b9516aac6fdca75bd4d8fb61a2bdf0bc 100644 (file)
@@ -51,11 +51,7 @@ AH_BOTTOM([
 # include <ieeefp.h>
 #endif
 
-#ifdef HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-#endif
+#include <string.h>
 
 #if ZEND_BROKEN_SPRINTF
 int zend_sprintf(char *buffer, const char *format, ...);
@@ -447,7 +443,6 @@ pwd.h \
 resolv.h \
 signal.h \
 stdarg.h \
-string.h \
 syslog.h \
 sysexits.h \
 sys/ioctl.h \
index 66b40b9ca47f7fa2785db737c9dddc0fe8e4f3cc..2b4e04c01d4851a5b5f34da9ae4d01288200739b 100644 (file)
@@ -94,7 +94,7 @@ int main() { return foo(10, "", 3.14); }
         ])
       ])
 
-      AC_CHECK_HEADERS([string.h strings.h unistd.h sys/time.h sys/times.h stdarg.h limits.h])
+      AC_CHECK_HEADERS([strings.h unistd.h sys/time.h sys/times.h stdarg.h limits.h])
       AC_CHECK_SIZEOF(int, 4)
       AC_CHECK_SIZEOF(short, 2)
       AC_CHECK_SIZEOF(long, 4)
index 9adcff3fbab65097bdff2dfdde7ff2d1fa946d6f..8d3cd739c009128b914b0698b37b6bef8604f572 100644 (file)
@@ -29,9 +29,6 @@
 /* Define to 1 if you have the <strings.h> header file. */
 #undef HAVE_STRINGS_H
 
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
index d32cafd2d059a8134dd4594f56c501f9c949e8a0..72d7ef55141e1bd59ccb47269e5ba337af2bd5ab 100644 (file)
@@ -1,6 +1,5 @@
 #define HAVE_MEMORY_H 1
 /* #undef HAVE_STRINGS_H */
-#define HAVE_STRING_H 1
 /* #undef HAVE_STRCASECMP */
 #define HAVE_STRICMP 1
 #define HAVE_WIN32_NATIVE_THREAD 1
index 12ff178b61211d9bd60b8a5ba92efd5d06b579f3..4213cadb7aa7e41b512b08810b95bb2a49f8f484 100644 (file)
 #include "config.h"
 #endif
 
-#ifdef HAVE_STRING_H
 #include <string.h>
-#endif
-
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-
 #include "mbfilter.h"
 #include "mbfilter_htmlent.h"
 #include "html_entities.h"
index 56f03b63553eebdb82034d976d02f6b6027afa58..68210631360e23729253b42125e43427159b5017 100644 (file)
 #endif
 
 #include <stddef.h>
-
-#ifdef HAVE_STRING_H
 #include <string.h>
-#endif
-
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
 
 #include "mbfilter.h"
 #include "mbfl_filter_output.h"
index c8bd0486e01cc67d5e77daf4aeff305d075d0488..86636f69c52729114e4609625ec875d40afd62d3 100644 (file)
 #include <memory.h>
 #endif
 
-#ifdef HAVE_STRING_H
 #include <string.h>
-#endif
-
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-
 #include <stddef.h>
 
 #include "mbfl_allocators.h"
index a1367230d856b1b34e64fcf6532f6fe85216d420..d8049617014881ff519021aea33083de440abfab 100644 (file)
 #endif
 
 #include <stddef.h>
-
-#ifdef HAVE_STRING_H
 #include <string.h>
-#endif
 
 #ifdef HAVE_STRINGS_H
 #include <strings.h>
index ca0307983fcfddf863558605096c7d3c552ed1ac..0d5e6a247125495296a7f5bb434386c803791907 100644 (file)
 #endif
 
 #include <stddef.h>
-
-#ifdef HAVE_STRING_H
 #include <string.h>
-#endif
 
 #ifdef HAVE_STRINGS_H
 #include <strings.h>
index fb3120f4452645e4f7f7fff043ee649a23d692cd..b44472366fc5d3893c63d8c383cbdef303166e89 100644 (file)
 #include <math.h>
 #include <time.h>
 #include <stdio.h>
-#if HAVE_STRING_H
 #include <string.h>
-#else
-#include <strings.h>
-#endif
 #ifdef PHP_WIN32
 #include "win32/unistd.h"
 #endif
index 160e510831fb6f7071cdfaabe052154906264513..f60c09b5e43a3e681f82b58a9d7ecd7a55be2f17 100644 (file)
@@ -75,11 +75,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
 # include <unistd.h>
 #endif
 
-#if HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-#endif
+#include <string.h>
 
 #if HAVE_LOCALE_H
 # include <locale.h>
index cc9597a28ee3df7f0a2c01ffd6fd0205dec95553..38dd089e4e457355c66cf696a38a78f3fb4c06b7 100644 (file)
 # endif
 #endif
 #include <time.h>
-#if HAVE_STRING_H
 #include <string.h>
-#else
-#include <strings.h>
-#endif
 
 #ifdef PHP_WIN32
 #include <process.h>
index 7b45f7301977d15ac4231ebf82f9fe68a99b79cf..749b45ae4720228521d1fa80dcba1639fb069554 100644 (file)
 #else
 # include <sys/param.h>
 # include <sys/types.h>
-# if HAVE_STRING_H
-#  include <string.h>
-# else
-#  include <strings.h>
-# endif
+# include <string.h>
 #endif
 
 char * __php_stpncpy(char *dst, const char *src, size_t len)
index f71c69e5ec6120b9a58a1d8da561d61ad05ee704..0ef2a62afb5f6d082f7b09b9edffec044a30fca0 100644 (file)
 #else
 # include <sys/param.h>
 # include <sys/types.h>
-# if HAVE_STRING_H
-#  include <string.h>
-# else
-#  include <strings.h>
-# endif
+# include <string.h>
 #endif
 
 extern void * __php_mempcpy(void * dst, const void * src, size_t len);
index 5ac18f126ff4fa390842f6b74aaa55a8281d4600..ec98b0bcc04a7d5e0851c1884ac49a06b470f0bb 100644 (file)
 #if defined(HAVE_LIBDL)
 #include <stdlib.h>
 #include <stdio.h>
-#ifdef HAVE_STRING_H
 #include <string.h>
-#else
-#include <strings.h>
-#endif
 #ifdef PHP_WIN32
 #include "win32/param.h"
 #include "win32/winutil.h"
index d841d08c2d7e5c90ed59751e136c5825dd360aaa..b1d99bc316155cfda969e5abc9c3b4e8207b0b1b 100644 (file)
@@ -12,7 +12,7 @@ AC_CHECK_FUNCS( \
 
 AC_DEFUN([XMLRPC_HEADER_CHECKS],[
 AC_HEADER_STDC
-AC_CHECK_HEADERS(xmlparse.h xmltok.h strings.h string.h)
+AC_CHECK_HEADERS(xmlparse.h xmltok.h strings.h)
 ])
 
 AC_DEFUN([XMLRPC_TYPE_CHECKS],[
index d136bbd1777198c59c497ab37952838c50afc521..07d1f01af96b61a3bfe5e223c2874a5dd5a31394 100644 (file)
 
 #if !HAVE_ALLOCA
 
-#ifdef HAVE_STRING_H
 #include <string.h>
-#endif
-
 #include <stdlib.h>
 
 #ifdef emacs
index 76628528a4acf8d0e40d875b9a2be7a33149d0dc..3c48c754da26928c8dd8b3cd2d5628a6f8d1c3a8 100644 (file)
@@ -42,9 +42,7 @@
 
 #ifndef HAVE_ALPHASORT
 
-#ifdef HAVE_STRING_H
 #include <string.h>
-#endif
 
 PHPAPI int php_alphasort(const struct dirent **a, const struct dirent **b)
 {
index 2173d84cdb31ad43d6c43357e8417229bdf21b0a..cfb3f43fa3d6ce95f4165c82979d203e674aeb70 100644 (file)
@@ -98,7 +98,6 @@
 #define HAVE_FCNTL_H 1
 #define HAVE_GRP_H 0
 #undef HAVE_PWD_H
-#define HAVE_STRING_H 1
 #undef HAVE_SYS_FILE_H
 #undef HAVE_SYS_SOCKET_H
 #undef HAVE_SYS_WAIT_H