diff options
-rw-r--r-- | Zend/Zend.m4 | 7 | ||||
-rw-r--r-- | Zend/acconfig.h | 14 | ||||
-rw-r--r-- | Zend/zend_config.w32.h | 2 | ||||
-rw-r--r-- | Zend/zend_operators.h | 10 |
4 files changed, 20 insertions, 13 deletions
diff --git a/Zend/Zend.m4 b/Zend/Zend.m4 index ef236bbed0..79d2c69138 100644 --- a/Zend/Zend.m4 +++ b/Zend/Zend.m4 @@ -64,7 +64,9 @@ AC_FUNC_MEMCMP AC_FUNC_ALLOCA AC_CHECK_FUNCS(memcpy strdup getpid kill strtod strtol finite) AC_ZEND_BROKEN_SPRINTF - + +AC_CHECK_FUNCS(finite isfinite isinf isnan) + AC_SUBST(ZEND_SCANNER) ]) @@ -95,9 +97,6 @@ AC_ARG_ENABLE(debug, - - - AC_DEFUN(LIBZEND_OTHER_CHECKS,[ AC_ARG_ENABLE(c9x-inline, diff --git a/Zend/acconfig.h b/Zend/acconfig.h index 85e52829f1..9b3153daf1 100644 --- a/Zend/acconfig.h +++ b/Zend/acconfig.h @@ -35,6 +35,20 @@ int zend_sprintf(char *buffer, const char *format, ...); # define zend_sprintf sprintf #endif +#ifdef HAVE_FINITE +#define zend_finite(a) finite(a) +#elif defined(HAVE_ISFINITE) +#define zend_finite(a) isfinite(a) +#elif defined(HAVE_ISNAN) && defined(HAVE_ISINF) +#define zend_finite(a) (isnan(a) ? 0 : isinf(a) ? 0 : 1) +#elif defined(HAVE_ISNAN) +#define zend_finite(a) (isnan(a) ? 0 : 1) +#elif defined(HAVE_ISINF) +#define zend_finite(a) (isinf(a) ? 0 : 1) +#else +#define zend_finite(a) (1) +#endif + /* * Local variables: * tab-width: 4 diff --git a/Zend/zend_config.w32.h b/Zend/zend_config.w32.h index 8b60474bbf..d8d0f72613 100644 --- a/Zend/zend_config.w32.h +++ b/Zend/zend_config.w32.h @@ -63,7 +63,7 @@ typedef unsigned int uint; # define inline #endif -#define finite(A) _finite(A) +#define zend_finite(A) _finite(A) #ifdef LIBZEND_EXPORTS # define ZEND_API __declspec(dllexport) diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 404209660c..5b95f6f454 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -24,15 +24,9 @@ #include <errno.h> #include <math.h> -#ifndef HAVE_FINITE -#ifndef finite /* in case it's already a macro */ -#define finite(a) isfinite(a) /* HPUX 11 only has isfinite() */ -#endif -#else -#if HAVE_IEEEFP_H +#ifdef HAVE_IEEEFP_H #include <ieeefp.h> #endif -#endif #if WITH_BCMATH #include "ext/bcmath/number.h" @@ -87,7 +81,7 @@ ZEND_API inline int is_numeric_string(char *str, int length, long *lval, double errno=0; local_dval = strtod(str, &end_ptr); if (errno!=ERANGE && end_ptr == str+length) { /* floating point string */ - if (! finite(local_dval)) { + if (! zend_finite(local_dval)) { /* "inf","nan" and maybe other weird ones */ return 0; } |