From: Matthew Fernandez Date: Wed, 14 Sep 2022 01:24:01 +0000 (-0700) Subject: dotgen computeLayerWidths: use cgraph wrappers for allocation X-Git-Tag: 6.0.2~38^2~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4376750b740e0015ade8ed128d5fdb6cf19301b3;p=graphviz dotgen computeLayerWidths: 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/lib/dotgen/aspect.c b/lib/dotgen/aspect.c index ae67a7923..8b7440f31 100644 --- a/lib/dotgen/aspect.c +++ b/lib/dotgen/aspect.c @@ -195,11 +195,10 @@ static void computeLayerWidths(graph_t * g) /* allocate memory * the number of layers can go up to the number of node groups */ - layerWidthInfo = N_NEW(nNodeGroups, layerWidthInfo_t); + layerWidthInfo = gv_calloc(nNodeGroups, sizeof(layerWidthInfo_t)); for (i = 0; i < nNodeGroups; i++) { - layerWidthInfo[i].nodeGroupsInLayer = - N_NEW(nNodeGroups, nodeGroup_t *); + layerWidthInfo[i].nodeGroupsInLayer = gv_calloc(nNodeGroups, sizeof(nodeGroup_t*)); assert(nNodeGroups >= 0); layerWidthInfo[i].removed = bitarray_new_or_exit((size_t)nNodeGroups);