From 303a288145063fa63ec266d3be775c819b2b0327 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 3 Sep 2022 10:55:41 -0700 Subject: [PATCH] ortho convertSPtoRoute: use cgraph wrapper 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. --- lib/ortho/ortho.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ortho/ortho.c b/lib/ortho/ortho.c index d68d800cd..8c833cdcc 100644 --- a/lib/ortho/ortho.c +++ b/lib/ortho/ortho.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -160,7 +161,7 @@ convertSPtoRoute (sgraph* g, snode* fst, snode* lst) for (ptr = fst; ptr; ptr = N_DAD(ptr)) sz++; rte.n = 0; assert(sz >= 2); - rte.segs = N_NEW(sz-2, segment); /* at most sz-2 segments */ + rte.segs = gv_calloc(sz - 2, sizeof(segment)); /* at most sz-2 segments */ seg.prev = seg.next = 0; ptr = prev = N_DAD(fst); -- 2.40.0