[gimp/gimp-2-10] Replace finite() with isfinite() by default



commit 04997fc0ae852f4db9561611c7615da07cdff8a5
Author: Alex Samorukov <samm net-art cz>
Date:   Thu Nov 7 09:09:22 2019 +0000

    Replace finite() with isfinite() by default
    
    This is part of the C standard also also causing warning on macOS.

 app/core/gimp-transform-resize.c |  6 +++---
 app/core/gimpcurve-map.c         |  6 +++---
 configure.ac                     | 30 +++++++++++++++++++-----------
 pdb/groups/image.pdb             |  6 +++---
 4 files changed, 28 insertions(+), 20 deletions(-)
---
diff --git a/app/core/gimp-transform-resize.c b/app/core/gimp-transform-resize.c
index 50e44d6f4a..dffc133274 100644
--- a/app/core/gimp-transform-resize.c
+++ b/app/core/gimp-transform-resize.c
@@ -31,10 +31,10 @@
 #include "gimp-utils.h"
 
 
-#if defined (HAVE_FINITE)
-#define FINITE(x) finite(x)
-#elif defined (HAVE_ISFINITE)
+#if defined (HAVE_ISFINITE)
 #define FINITE(x) isfinite(x)
+#elif defined (HAVE_FINITE)
+#define FINITE(x) finite(x)
 #elif defined (G_OS_WIN32)
 #define FINITE(x) _finite(x)
 #else
diff --git a/app/core/gimpcurve-map.c b/app/core/gimpcurve-map.c
index 604d4ecb5d..bd39b27a71 100644
--- a/app/core/gimpcurve-map.c
+++ b/app/core/gimpcurve-map.c
@@ -30,10 +30,10 @@
 #include "gimpcurve-map.h"
 
 
-#if defined (HAVE_FINITE)
-#define FINITE(x) finite(x)
-#elif defined (HAVE_ISFINITE)
+#if defined (HAVE_ISFINITE)
 #define FINITE(x) isfinite(x)
+#elif defined (HAVE_FINITE)
+#define FINITE(x) finite(x)
 #elif defined (G_OS_WIN32)
 #define FINITE(x) _finite(x)
 #else
diff --git a/configure.ac b/configure.ac
index 8611c898b5..8eac80e2f5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1021,7 +1021,7 @@ AC_RUN_IFELSE(
      [AC_MSG_RESULT])],
   [AC_MSG_RESULT()])
 
-# Check for finite or isfinite
+# Check for finite
 AC_CHECK_FUNCS(finite, , [
   AC_MSG_CHECKING(for finite in <math.h>)
   AC_LINK_IFELSE(
@@ -1030,15 +1030,23 @@ AC_CHECK_FUNCS(finite, , [
       [[double f = 0.0; finite (f)]])],
     [AC_DEFINE(HAVE_FINITE, 1)
      AC_MSG_RESULT(yes)],
-    [AC_MSG_RESULT(no)
-     AC_MSG_CHECKING(for isfinite in <math.h>)
-     AC_LINK_IFELSE(
-       [AC_LANG_PROGRAM(
-         [[#include <math.h>]],
-         [[float f = 0.0; isfinite(f)]])],
-       [AC_DEFINE([HAVE_ISFINITE],[1],[Define to 1 if you have the isfinite function.])
-        AC_MSG_RESULT(yes)],
-       [AC_MSG_RESULT(no)])])])
+    [AC_MSG_RESULT(no)])
+  ]
+)
+
+# Check for isfinite
+AC_CHECK_FUNCS(isfinite, , [
+  AC_MSG_CHECKING(for isfinite in <math.h>)
+  AC_LINK_IFELSE(
+    [AC_LANG_PROGRAM(
+      [[#include <math.h>]],
+      [[double f = 0.0; isfinite (f)]])],
+    [AC_DEFINE(HAVE_ISFINITE, 1)
+     AC_MSG_RESULT(yes)],
+    [AC_MSG_RESULT(no)])
+  ]
+)
+
 AC_SUBST(HAVE_FINITE)
 AC_SUBST(HAVE_ISFINITE)
 
@@ -1340,7 +1348,7 @@ AC_MSG_CHECKING([whether symbols are prefixed])
 
 case "$host_os" in
   mingw*)
-    case "$host_cpu" in 
+    case "$host_cpu" in
          x86_64) SYMPREFIX='' ;;
          *) SYMPREFIX='_' ;;
        esac
diff --git a/pdb/groups/image.pdb b/pdb/groups/image.pdb
index e657df2fac..9eb7e1af1e 100644
--- a/pdb/groups/image.pdb
+++ b/pdb/groups/image.pdb
@@ -3106,10 +3106,10 @@ CODE
 
 
 $extra{app}->{code} = <<'CODE';
-#if defined (HAVE_FINITE)
-#define FINITE(x) finite(x)
-#elif defined (HAVE_ISFINITE)
+#if defined (HAVE_ISFINITE)
 #define FINITE(x) isfinite(x)
+#elif defined (HAVE_FINITE)
+#define FINITE(x) finite(x)
 #elif defined (G_OS_WIN32)
 #define FINITE(x) _finite(x)
 #else


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]