]> granicus.if.org Git - graphviz/commitdiff
lib/mingle: scope use of an array to a local temp
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 6 Jan 2022 06:13:16 +0000 (22:13 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 8 Jan 2022 16:15:32 +0000 (08:15 -0800)
Similar to the preceding changes for `sources`, it is not clear to me why this
code was using the `targets` array when the output values are irrelevant.

lib/mingle/ink.cpp

index dbf60269b756d114927bbfcb5d4e6133fe920b6f..1fe28c72a803e8eaa75e36cf2ced90df280e85b9 100644 (file)
@@ -252,11 +252,11 @@ double ink(pedge* edges, int numEdges, int *pick, double *ink0, point_t *meet1,
     }
     x = e->x;
     point_t source = {x[0], x[1]};
-    targets[i].x = x[e->dim*e->npoints - e->dim];
-    targets[i].y = x[e->dim*e->npoints - e->dim + 1];
-    (*ink0) += hypot(source.x - targets[i].x, source.y - targets[i].y);
+    point_t target = {x[e->dim*e->npoints - e->dim],
+                      x[e->dim*e->npoints - e->dim + 1]};
+    (*ink0) += hypot(source.x - target.x, source.y - target.y);
     begin = addPoint (begin, scalePoint(source, e->wgt));
-    end = addPoint (end, scalePoint(targets[i], e->wgt));
+    end = addPoint (end, scalePoint(target, e->wgt));
     wgt += e->wgt;
   }