]> granicus.if.org Git - graphviz/commitdiff
sparse cmp: rephrase a comparison to avoid a -Wfloat-equal warning
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 4 Sep 2021 01:07:41 +0000 (18:07 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 11 Sep 2021 15:34:08 +0000 (08:34 -0700)
Simply makes it clearer to the compiler what this code is doing.

lib/sparse/SparseMatrix.c

index df0ad6ced475410724c2587f7984a4f1fbdd4535..51cfd41fd7dc0b654fc2b1a124683c87c4ad3ed0 100644 (file)
@@ -2023,11 +2023,11 @@ static int cmp(void*i, void*j){
   d2 = (nodedata) j;
   if (d1->dist > d2->dist){
     return 1;
-  } else if (d1->dist == d2->dist){
-    return 0;
-  } else {
+  }
+  if (d1->dist < d2->dist) {
     return -1;
   }
+  return 0;
 }
 
 static int Dijkstra_internal(SparseMatrix A, int root, real *dist, int *nlist, int *list, real *dist_max, int *mask){