[前][次][番号順一覧][スレッド一覧]

ruby-changes:32426

From: nobu <ko1@a...>
Date: Sun, 5 Jan 2014 21:33:47 +0900 (JST)
Subject: [ruby-changes:32426] nobu:r44505 (trunk): numeric.c: isfinite

nobu	2014-01-05 21:33:42 +0900 (Sun, 05 Jan 2014)

  New Revision: 44505

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44505

  Log:
    numeric.c: isfinite
    
    * numeric.c (flo_is_finite_p): prefer C99 standard isfinite() than
      deprecated finite().

  Modified files:
    trunk/configure.in
    trunk/numeric.c
Index: configure.in
===================================================================
--- configure.in	(revision 44504)
+++ configure.in	(revision 44505)
@@ -1883,6 +1883,7 @@ AC_CHECK_FUNCS(gettimeofday)		# for maki https://github.com/ruby/ruby/blob/trunk/configure.in#L1883
 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)
Index: numeric.c
===================================================================
--- numeric.c	(revision 44504)
+++ numeric.c	(revision 44505)
@@ -30,8 +30,12 @@ https://github.com/ruby/ruby/blob/trunk/numeric.c#L30
 #include <ieeefp.h>
 #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) https://github.com/ruby/ruby/blob/trunk/numeric.c#L1461
 {
     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))

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]