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

index d5eae637623d591ac1e6665dd409f268e8595022..7ede420fa3683a1df39cc5ba83997c0b8f7bf010 100644 (file)
@@ -131,7 +131,6 @@ static void chkBoundBox(Agraph_t * graph)
 static int makeInfo(Agraph_t * graph)
 {
     Agnode_t *node;
-    Info_t *ip;
     expand_t pmargin;
     int (*polyf)(Poly *, Agnode_t *, float, float);
 
@@ -142,7 +141,6 @@ static int makeInfo(Agraph_t * graph)
     nodeInfo = gv_calloc(nsites, sizeof(Info_t));
 
     node = agfstnode(graph);
-    ip = nodeInfo;
 
     pmargin = sepFactor (graph);
 
@@ -155,6 +153,7 @@ static int makeInfo(Agraph_t * graph)
        
     else polyf = makePoly;
     for (size_t i = 0; i < nsites; i++) {
+       Info_t *ip = &nodeInfo[i];
        ip->site.coord.x = ND_pos(node)[0];
        ip->site.coord.y = ND_pos(node)[1];
 
@@ -169,7 +168,6 @@ static int makeInfo(Agraph_t * graph)
        ip->node = node;
        ip->verts = NULL;
        node = agnxtnode(graph, node);
-       ip++;
     }
     return 0;
 }