]> granicus.if.org Git - graphviz/commitdiff
overlapSeg: rephrase the order of comparisons to avoid a -Wfloat-equal warning
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 4 Sep 2021 01:02:22 +0000 (18:02 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 11 Sep 2021 15:33:17 +0000 (08:33 -0700)
Simply makes it clearer to the compiler what this code is doing.

lib/ortho/ortho.c

index 839c3d34746f0fe5b6590f3ab07b6446452c6efe..d61366d9823fe96e552f66b13a7669f6927c7588 100644 (file)
@@ -621,15 +621,13 @@ overlapSeg (segment* S1, segment* S2, bend T1, bend T2)
                else if(S1->l2==T2&&S2->l1==T1) return(1);
                else return(0);
        }
-       else if(S1->p.p2==S2->p.p2) {
-               if(S2->l1==T2) return eqEndSeg (S1->l2, S2->l2, T1, T2);
-               else return -1*eqEndSeg (S2->l2, S1->l2, T1, T2);
-       }
-       else { /* S1->p.p2>S2->p.p2 */
+       if (S1->p.p2 > S2->p.p2) {
                if(S2->l1==T2&&S2->l2==T2) return(-1);
                else if (S2->l1==T1&&S2->l2==T1) return(1);
                else return(0);
        }
+       if (S2->l1 == T2) return eqEndSeg (S1->l2, S2->l2, T1, T2);
+       return -1 * eqEndSeg(S2->l2, S1->l2, T1, T2);
 }
 
 static int