]> granicus.if.org Git - graphviz/commitdiff
sparse QuadTree_get_supernodes_internal: remove redundant branch
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 1 Jan 2023 21:17:52 +0000 (13:17 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 8 Jan 2023 19:06:26 +0000 (11:06 -0800)
lib/sparse/QuadTree.c

index 5917fe9a5097cd9be638ada87e9bd1acc21032c1..d27722e39b7857e287a320ea7ecb7ed375dbc2a8 100644 (file)
@@ -85,20 +85,18 @@ static void QuadTree_get_supernodes_internal(QuadTree qt, double bh, double *pt,
   if (!qt) return;
   dim = qt->dim;
   l = qt->l;
-  if (l){
-    while (l){
-      check_or_realloc_arrays(dim, nsuper, nsupermax, center, supernode_wgts, distances);
-      if (node_data_get_id(SingleLinkedList_get_data(l)) != nodeid){
-       coord = node_data_get_coord(SingleLinkedList_get_data(l));
-       for (i = 0; i < dim; i++){
-         (*center)[dim*(*nsuper)+i] = coord[i];
-       }
-       (*supernode_wgts)[*nsuper] = node_data_get_weight(SingleLinkedList_get_data(l));
-       (*distances)[*nsuper] = point_distance(pt, coord, dim);
-       (*nsuper)++;
+  while (l) {
+    check_or_realloc_arrays(dim, nsuper, nsupermax, center, supernode_wgts, distances);
+    if (node_data_get_id(SingleLinkedList_get_data(l)) != nodeid){
+      coord = node_data_get_coord(SingleLinkedList_get_data(l));
+      for (i = 0; i < dim; i++){
+        (*center)[dim*(*nsuper)+i] = coord[i];
       }
-      l = SingleLinkedList_get_next(l);
+      (*supernode_wgts)[*nsuper] = node_data_get_weight(SingleLinkedList_get_data(l));
+      (*distances)[*nsuper] = point_distance(pt, coord, dim);
+      (*nsuper)++;
     }
+    l = SingleLinkedList_get_next(l);
   }
 
   if (qt->qts){