From 006e66b6680f60adfb434ee7397f0dbc77de7873 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 5 Jan 2014 12:33:42 +0000 Subject: [PATCH] numeric.c: isfinite * numeric.c (flo_is_finite_p): prefer C99 standard isfinite() than deprecated finite(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- configure.in | 1 + numeric.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index 35e04739d2..f993a1bc3e 100644 --- a/configure.in +++ b/configure.in @@ -1883,6 +1883,7 @@ AC_CHECK_FUNCS(gettimeofday) # for making ac_cv_func_gettimeofday AC_CHECK_FUNCS(gmtime_r) AC_CHECK_FUNCS(initgroups) AC_CHECK_FUNCS(ioctl) +AC_CHECK_FUNCS(isfinite) AC_CHECK_FUNCS(issetugid) AC_CHECK_FUNCS(killpg) AC_CHECK_FUNCS(lchmod) diff --git a/numeric.c b/numeric.c index 734ab3455b..f4233d9460 100644 --- a/numeric.c +++ b/numeric.c @@ -30,8 +30,12 @@ #include #endif +#if !defined HAVE_ISFINITE && !defined isfinite #if defined HAVE_FINITE && !defined finite && !defined _WIN32 extern int finite(double); +# define HAVE_ISFINITE 1 +# define isfinite(x) finite(x) +#endif #endif /* use IEEE 64bit values if not defined */ @@ -1457,8 +1461,8 @@ flo_is_finite_p(VALUE num) { double value = RFLOAT_VALUE(num); -#if HAVE_FINITE - if (!finite(value)) +#if HAVE_ISFINITE + if (!isfinite(value)) return Qfalse; #else if (isinf(value) || isnan(value))