]> granicus.if.org Git - graphviz/commitdiff
fdpgen addEdge: 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 04:07:19 +0000 (20:07 -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 cb4a7137d48409cb9ede9181390cf0da369b769a..9ffe682a6e8d8d3de33359b72c5b543f6d6771bd 100644 (file)
@@ -383,7 +383,7 @@ static void addEdge(edge_t * de, edge_t * e)
     edge_t **el;
 
     el = (edge_t **) (ED_to_virt(de));
-    el = ALLOC(cnt + 1, el, edge_t *);
+    el = gv_recalloc(el, cnt, cnt + 1, sizeof(edge_t*));
     el[cnt] = e;
     ED_to_virt(de) = (edge_t *) el;
     ED_count(de)++;