]> granicus.if.org Git - graphviz/commitdiff
neatogen makeInfo: 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>
Fri, 25 Nov 2022 18:30:51 +0000 (10:30 -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/neatogen/adjust.c

index 73497c9795b4d5f02ee54e98f0f216459137d3db..97ae5fb0fb9e963c46f55765deb27f91cc5ff1fe 100644 (file)
@@ -13,6 +13,7 @@
  * order to reduce/remove node overlaps.
  */
 
+#include <cgraph/alloc.h>
 #include <neatogen/neato.h>
 #include <cgraph/agxbuf.h>
 #include <common/utils.h>
@@ -142,7 +143,7 @@ static int makeInfo(Agraph_t * graph)
     nsites = agnnodes(graph);
     geominit();
 
-    nodeInfo = N_GNEW(nsites, Info_t);
+    nodeInfo = gv_calloc(nsites, sizeof(Info_t));
 
     node = agfstnode(graph);
     ip = nodeInfo;