From: Matthew Fernandez Date: Thu, 22 Sep 2022 02:51:58 +0000 (-0700) Subject: mm2gv makeDotGraph: use cgraph wrappers for allocation X-Git-Tag: 6.0.2~15^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5dc7f0b55178c655a86ddc5b052f4436a026f648;p=graphviz mm2gv makeDotGraph: use cgraph wrappers for allocation 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. --- diff --git a/cmd/tools/mm2gv.c b/cmd/tools/mm2gv.c index 07b56872a..e578bf676 100644 --- a/cmd/tools/mm2gv.c +++ b/cmd/tools/mm2gv.c @@ -14,6 +14,7 @@ *************************************************************************/ #include "config.h" +#include #include #define STANDALONE @@ -90,7 +91,7 @@ static Agraph_t *makeDotGraph(SparseMatrix A, char *name, int dim, int *ia = A->ia; int *ja = A->ja; double *val = A->a; - Agnode_t **arr = N_NEW(A->m, Agnode_t *); + Agnode_t **arr = gv_calloc(A->m, sizeof(Agnode_t*)); double *color = NULL; char cstring[8]; @@ -138,7 +139,7 @@ static Agraph_t *makeDotGraph(SparseMatrix A, char *name, int dim, sym2 = agattr(g, AGEDGE, "color", ""); sym3 = agattr(g, AGEDGE, "wt", ""); agattr(g, AGRAPH, "bgcolor", "black"); - color = N_NEW(A->nz, double); + color = gv_calloc(A->nz, sizeof(double)); for (n = agfstnode(g); n; n = agnxtnode(g, n)) { i = ND_id(n); if (A->type != MATRIX_TYPE_REAL) {