]> granicus.if.org Git - graphviz/commitdiff
smyrna makeGraph: use cgraph wrapper for allocations
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 2 Sep 2022 01:37:24 +0000 (18:37 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 2 Sep 2022 01:37:24 +0000 (18:37 -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.

cmd/smyrna/topfisheyeview.c

index 43ad3715ecd0ff684a9b3cff54b49f57c851b7c1..4363157cd7c2cb282dbfbc44373891bf639d0868 100644 (file)
@@ -8,7 +8,7 @@
  * Contributors: Details at https://graphviz.org
  *************************************************************************/
 #include "topfisheyeview.h"
-
+#include <cgraph/alloc.h>
 #include <math.h>
 #include <common/memory.h>
 #include "viewport.h"
@@ -54,9 +54,9 @@ static v_data *makeGraph(Agraph_t* gg, int *nedges)
     int i;
     int ne = agnedges(gg);
     int nv = agnnodes(gg);
-    v_data *graph = N_NEW(nv, v_data);
-    int *edges = N_NEW(2 * ne + nv, int);      /* reserve space for self loops */
-    float *ewgts = N_NEW(2 * ne + nv, float);
+    v_data *graph = gv_calloc(nv, sizeof(v_data));
+    int *edges = gv_calloc(2 * ne + nv, sizeof(int));  /* reserve space for self loops */
+    float *ewgts = gv_calloc(2 * ne + nv, sizeof(float));
     Agnode_t *np;
     Agedge_t *ep;
     Agraph_t *g = NULL;