]> granicus.if.org Git - graphviz/commitdiff
remove unnecessary not-null guards on free in spring_electrical_embedding_fast
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 26 Jun 2021 23:21:16 +0000 (16:21 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 17 Jul 2021 17:45:45 +0000 (10:45 -0700)
It is well-defined to free null.

lib/sfdpgen/spring_electrical.c

index 6f192c32068e0ac659579a2b3263dac1638cefe5..a6cfd9c488e4c2d38bc078492e56cb5b57e712f9 100644 (file)
@@ -659,13 +659,11 @@ void spring_electrical_embedding_fast(int dim, SparseMatrix A0, spring_electrica
   oned_optimizer_delete(qtree_level_optimizer);
   ctrl->max_qtree_level = max_qtree_level;
 
-  if (xold) FREE(xold);
+  FREE(xold);
   if (A != A0) SparseMatrix_delete(A);
-  if (force) FREE(force);
-
+  FREE(force);
 }
 
-
 static void spring_electrical_embedding_slow(int dim, SparseMatrix A0, spring_electrical_control ctrl, real *node_weights, real *x, int *flag){
   /* a version that does vertex moves in one go, instead of one at a time, use for debugging the fast version. Quadtree is not used. */
   /* x is a point to a 1D array, x[i*dim+j] gives the coordinate of the i-th node at dimension j.  */