]> granicus.if.org Git - graphviz/commitdiff
gvcolor: remove open coded 'fmax'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 8 Apr 2022 01:51:20 +0000 (18:51 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 10 Apr 2022 20:48:40 +0000 (13:48 -0700)
cmd/tools/CMakeLists.txt
cmd/tools/gvcolor.c

index 170835e8c9bcc9c8f603cd2243c2b94fa68461dd..7726e67afaf289fe321a20c5318c1477820fb1ab 100644 (file)
@@ -227,6 +227,7 @@ target_include_directories(gvcolor SYSTEM PRIVATE
 target_link_libraries(gvcolor
   cgraph
   ingraphs
+  ${MATH_LIB}
 )
 
 tool_defaults(gvcolor)
index 5e1e1e696e7a3f1e65bd16fe6862aa2fdbe16f3d..263e406f3de0f2c4b9a90c75bf681230969aedbc 100644 (file)
@@ -22,6 +22,7 @@
 #include <assert.h>
 #include <cgraph/cgraph.h>
 #include <cgraph/exit.h>
+#include <math.h>
 #include <stdlib.h>
 typedef struct Agnodeinfo_t {
     Agrec_t h;
@@ -155,8 +156,7 @@ static void color(Agraph_t * g)
        p = agget(n, "pos");
        sscanf(p, "%lf,%lf", &x, &y);
        ND_relrank(n) = (LR ? x : y);
-       if (maxrank < ND_relrank(n))
-           maxrank = ND_relrank(n);
+       maxrank = fmax(maxrank, ND_relrank(n));
     }
     if (LR != Forward)
        for (i = 0; i < nnodes; i++) {