From 825509ee9e6048844debcf79059f2a0c7d0c5a12 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Fri, 27 Sep 2024 17:34:54 +0200 Subject: [PATCH] Drop superfluous LONG_MAX/LONG_MIN fallback definitions (GH-15667) Both macros are supposed to be defined in limits.h (C99) and as such it is superfluous to provide fallback definitions. Even worse, because these fallback definitions didn't cater to LP64, ILP64 and SILP64 data models (and maybe some rather uncommon ones), but just assumed ILP32, they are confusing. --- Zend/zend_portability.h | 8 -------- Zend/zend_strtod.c | 4 ---- ext/bcmath/libbcmath/src/bcmath.h | 5 ----- main/php.h | 8 -------- 4 files changed, 25 deletions(-) diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h index 5be8d7e4f5c..f4609428326 100644 --- a/Zend/zend_portability.h +++ b/Zend/zend_portability.h @@ -444,14 +444,6 @@ char *alloca(); # define ZTS_V 0 #endif -#ifndef LONG_MAX -# define LONG_MAX 2147483647L -#endif - -#ifndef LONG_MIN -# define LONG_MIN (- LONG_MAX - 1) -#endif - #define MAX_LENGTH_OF_DOUBLE 32 #undef MIN diff --git a/Zend/zend_strtod.c b/Zend/zend_strtod.c index 86cf775a9b7..8115e041c0c 100644 --- a/Zend/zend_strtod.c +++ b/Zend/zend_strtod.c @@ -292,10 +292,6 @@ static double private_mem[PRIVATE_mem], *pmem_next = private_mem; #define DBL_MAX 1.7014118346046923e+38 #endif -#ifndef LONG_MAX -#define LONG_MAX 2147483647 -#endif - #else /* ifndef Bad_float_h */ #include "float.h" #endif /* Bad_float_h */ diff --git a/ext/bcmath/libbcmath/src/bcmath.h b/ext/bcmath/libbcmath/src/bcmath.h index 4b8ca123264..f346624b09e 100644 --- a/ext/bcmath/libbcmath/src/bcmath.h +++ b/ext/bcmath/libbcmath/src/bcmath.h @@ -74,11 +74,6 @@ typedef struct bc_struct { #define MAX(a, b) ((a)>(b)?(a):(b)) #define MIN(a, b) ((a)>(b)?(b):(a)) -#ifndef LONG_MAX -#define LONG_MAX 0x7fffffff -#endif - - /* Function Prototypes */ void bc_init_numbers(void); diff --git a/main/php.h b/main/php.h index f9d09204f2f..c00777a1b40 100644 --- a/main/php.h +++ b/main/php.h @@ -225,14 +225,6 @@ typedef unsigned int socklen_t; #include -#ifndef LONG_MAX -#define LONG_MAX 2147483647L -#endif - -#ifndef LONG_MIN -#define LONG_MIN (- LONG_MAX - 1) -#endif - #ifndef INT_MAX #define INT_MAX 2147483647 #endif