]> granicus.if.org Git - graphviz/commitdiff
fdpgen addCluster: use cgraph wrapper for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 18 Nov 2022 01:14:41 +0000 (17:14 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 23 Nov 2022 03:39:46 +0000 (19:39 -0800)
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/fdpgen/layout.c

index a4226ab4b73545fbfe42a1b7ca90aa557d5821f9..cb4a7137d48409cb9ede9181390cf0da369b769a 100644 (file)
@@ -298,8 +298,9 @@ static void addCluster(clist_t * clist, graph_t * subg)
 {
     clist->cnt++;
     if (clist->cnt >= clist->sz) {
+       clist->cl = gv_recalloc(clist->cl, clist->sz, clist->sz + CL_CHUNK,
+                               sizeof(graph_t*));
        clist->sz += CL_CHUNK;
-       clist->cl = RALLOC(clist->sz, clist->cl, graph_t *);
     }
     clist->cl[clist->cnt] = subg;
 }