]> granicus.if.org Git - graphviz/commitdiff
neatogen countOverlap: use a clearer iteration idiom
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 20 Nov 2022 00:19:20 +0000 (16:19 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 25 Nov 2022 18:33:31 +0000 (10:33 -0800)
lib/neatogen/adjust.c

index 44336995dca1a14fd3e4f21cd26767b23a27bfe2..3fa7966f3fad83bb258da5b8466f6778c151a223 100644 (file)
@@ -306,23 +306,20 @@ static void rmEquality(void)
 static int countOverlap(int iter)
 {
     int count = 0;
-    Info_t *ip = nodeInfo;
-    Info_t *jp;
 
     for (size_t i = 0; i < nsites; i++)
        nodeInfo[i].overlaps = 0;
 
     for (size_t i = 0; i < nsites - 1; i++) {
-       jp = ip + 1;
+       Info_t *ip = &nodeInfo[i];
        for (size_t j = i + 1; j < nsites; j++) {
+           Info_t *jp = &nodeInfo[j];
            if (polyOverlap(ip->site.coord, &ip->poly, jp->site.coord, &jp->poly)) {
                count++;
                ip->overlaps = 1;
                jp->overlaps = 1;
            }
-           jp++;
        }
-       ip++;
     }
 
     if (Verbose > 1)