]> granicus.if.org Git - php/commitdiff
Remove HAVE_LIMITS_H
authorPeter Kokot <peterkokot@gmail.com>
Sun, 7 Apr 2019 13:20:02 +0000 (15:20 +0200)
committerPeter Kokot <peterkokot@gmail.com>
Sun, 7 Apr 2019 13:20:02 +0000 (15:20 +0200)
The `<limits.h>` header file is part of the standard C89 headers [1]
and on current systems can be included unconditionally.

Since PHP requires at least C89 or greater, the `HAVE_LIMITS_H` symbol
defined by Autoconf in configure.ac [2] can be ommitted and simplifed
however due to bundled file library (libmagic) and timelib still using
it, the removal there was omitted and done only in Zend.m4 file.

Current bundled libraries libtime, oniguruma, and libmagic still include
partial `HAVE_LIMITS_H` usage and will be more refactored when this is
possible.

Refs:
[1] https://port70.net/~nsz/c/c89/c89-draft.html#4.1.2
[2] https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/headers.m4

TSRM/tsrm_config_common.h
Zend/Zend.m4
Zend/zend_alloc.c
Zend/zend_portability.h
ext/standard/exec.c
ext/standard/string.c
ext/standard/url_scanner_ex.re
main/php.h

index 64cecd912ae2c55378228fcfeef763f1c67e50d3..d3c7672d48f626f1d08a1e6619aba5f0f69b00e4 100644 (file)
@@ -35,9 +35,7 @@ char *alloca ();
 #include <unistd.h>
 #endif
 
-#if HAVE_LIMITS_H
 #include <limits.h>
-#endif
 
 #ifndef MAXPATHLEN
 # if _WIN32
index 29404631eb53b76623cce0d0cf77072da01423a3..c0ada26aeab6e7c0c03fd7ecb9c5b8fea2f4cb92 100644 (file)
@@ -8,7 +8,6 @@ AC_REQUIRE([AC_PROG_CC])
 AC_CHECK_HEADERS(
 inttypes.h \
 stdint.h \
-limits.h \
 malloc.h \
 unistd.h \
 sys/types.h \
index dabf48150cec13361181ce58556f2af97238fb12..77474c55279154a111136bd69dd470ad8bb84486 100644 (file)
@@ -77,9 +77,7 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#if HAVE_LIMITS_H
 #include <limits.h>
-#endif
 #include <fcntl.h>
 #include <errno.h>
 
index fe3f5c4245c3fdfed2474442409510bca5ba8338..56b7a1ada3d7eb5bfd65db124c964b77bf52fb96 100644 (file)
@@ -60,9 +60,7 @@
 # include <dlfcn.h>
 #endif
 
-#ifdef HAVE_LIMITS_H
-# include <limits.h>
-#endif
+#include <limits.h>
 
 #if HAVE_ALLOCA_H && !defined(_ALLOCA_H)
 # include <alloca.h>
index 63e1d97e1d8b316c40cc5631328979943c1ca550..38399458368190feb438896b3291ddc3139d3514 100644 (file)
@@ -49,9 +49,7 @@
 #include <unistd.h>
 #endif
 
-#if HAVE_LIMITS_H
 #include <limits.h>
-#endif
 
 #ifdef PHP_WIN32
 # include "win32/nice.h"
index 194ce9ff34beceb867f2a74b5c72e33db90e9a68..8fb0e81ab0b2fe3868145167d969bd654b2ff34c 100644 (file)
@@ -90,12 +90,6 @@ void register_string_constants(INIT_FUNC_ARGS)
 
 #ifdef HAVE_LOCALECONV
        /* If last members of struct lconv equal CHAR_MAX, no grouping is done */
-
-/* This is bad, but since we are going to be hardcoding in the POSIX stuff anyway... */
-# ifndef HAVE_LIMITS_H
-# define CHAR_MAX 127
-# endif
-
        REGISTER_LONG_CONSTANT("CHAR_MAX", CHAR_MAX, CONST_CS | CONST_PERSISTENT);
 #endif
 
index 0386d0e955fdbbf1ab457e4955e051311d4cbbbd..8ad129380eff0b0f48e08c71c629bab718d775aa 100644 (file)
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#endif
 
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 17aa3b3de5801885cd80fc03edb863e091a764ae..888344324eef3b229f8e18a11fd6654b44cfc8fc 100644 (file)
@@ -243,9 +243,7 @@ char *strerror(int);
 # endif
 #endif
 
-#if HAVE_LIMITS_H
 #include <limits.h>
-#endif
 
 #ifndef LONG_MAX
 #define LONG_MAX 2147483647L