From f9006b7184177019e5a3c7fe299dac93d9e14ce8 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Fri, 30 Aug 2024 20:37:40 +0200 Subject: [PATCH] Drop superfluous LONG_MAX/LONG_MIN fallback definitions 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 5be8d7e4f5ce..f4609428326c 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 6a358bb1128e..b2995197c9aa 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 07dd84ff90d1..5b4160bf4002 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 2ab4c39de5bf..276360d0f96b 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