From: Matthew Fernandez Date: Sat, 3 Sep 2022 18:10:42 +0000 (-0700) Subject: ortho PQgen: use cgraph wrappers for allocation X-Git-Tag: 6.0.1~11^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=92460b15e219b5d1827c327f6e0091adae66adb9;p=graphviz 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. --- 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; }