From 92460b15e219b5d1827c327f6e0091adae66adb9 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 3 Sep 2022 11:10:42 -0700 Subject: [PATCH] ortho PQgen: 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. --- lib/ortho/fPQ.c | 4 ++-- lib/ortho/fPQ.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ortho/fPQ.c b/lib/ortho/fPQ.c index 4f2de2947..39de81aa8 100644 --- a/lib/ortho/fPQ.c +++ b/lib/ortho/fPQ.c @@ -11,7 +11,7 @@ /* Priority Queue Code for shortest path in graph */ #include "config.h" -#include +#include #include #include @@ -25,7 +25,7 @@ void PQgen(int sz) { if (!pq) { - pq = N_NEW(sz+1,snode*); + pq = gv_calloc(sz + 1, sizeof(snode*)); pq[0] = &guard; PQsize = sz; } diff --git a/lib/ortho/fPQ.h b/lib/ortho/fPQ.h index 40bb68d7d..47b8302f8 100644 --- a/lib/ortho/fPQ.h +++ b/lib/ortho/fPQ.h @@ -13,6 +13,7 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#include #include #define N_VAL(n) (n)->n_val @@ -34,7 +35,7 @@ static void PQgen(int sz) { if (!pq) { - pq = N_NEW(sz+1,snode*); + pq = gv_calloc(sz + 1, sizeof(snode*)); pq[0] = &guard; PQsize = sz; } -- 2.40.0