]> granicus.if.org Git - graphviz/commitdiff
sfdpgen attach_edge_label_coordinates: use cgraph wrapper for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 10 Sep 2022 03:43:28 +0000 (20:43 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 11 Sep 2022 23:56:02 +0000 (16:56 -0700)
The lib/cgraph/alloc.h wrappers are similar to the older lib/common/memory.h
wrappers except (1) they are header-only and (2) they live in a directory
(cgraph) that is at the root of the dependency tree. The long term plan is to
replace all use of lib/common/memory.h with lib/cgraph/alloc.h.

lib/sfdpgen/spring_electrical.c

index 5c9f32ba50b08ab234ece744d116c0efa26ac8b3..3ea60eddb6d8e1ef7f929b473701d1d58e774a18 100644 (file)
@@ -1732,12 +1732,11 @@ static void rotate(int n, int dim, double *x, double angle){
 }
 
 static void attach_edge_label_coordinates(int dim, SparseMatrix A, int n_edge_label_nodes, int *edge_label_nodes, double *x, double *x2){
-  int *mask;
   int i, ii, j, k;
   int nnodes = 0;
   double len;
 
-  mask = MALLOC(sizeof(int)*A->m);
+  int *mask = gv_calloc(A->m, sizeof(int));
 
   for (i = 0; i < A->m; i++) mask[i] = 1;
   for (i = 0; i < n_edge_label_nodes; i++) {