From d125db4fdaf96fbab64e5ec939fee87e0be634aa Mon Sep 17 00:00:00 2001 From: John Ellson Date: Tue, 7 Apr 2020 18:23:34 -0400 Subject: [PATCH] Revert "Revert "Merge branch 'Grimler/graphviz-malloc.h-problem'"" This reverts commit 27592b90bfae96b68e8b52639be2bd827116bf92. --- lib/cgraph/Makefile.am | 5 +++-- lib/cgraph/{ => include}/malloc.h | 0 lib/sfdpgen/PriorityQueue.c | 16 ++++++---------- 3 files changed, 9 insertions(+), 12 deletions(-) rename lib/cgraph/{ => include}/malloc.h (100%) diff --git a/lib/cgraph/Makefile.am b/lib/cgraph/Makefile.am index bb6147b91..419940a7c 100644 --- a/lib/cgraph/Makefile.am +++ b/lib/cgraph/Makefile.am @@ -8,10 +8,11 @@ pkgconfigdir = $(libdir)/pkgconfig AM_CPPFLAGS = \ -I$(top_srcdir) \ - -I$(top_srcdir)/lib/cdt + -I$(top_srcdir)/lib/cdt \ + -Iinclude pkginclude_HEADERS = cgraph.h -noinst_HEADERS = agxbuf.h cghdr.h malloc.h +noinst_HEADERS = agxbuf.h cghdr.h include/malloc.h noinst_LTLIBRARIES = libcgraph_C.la lib_LTLIBRARIES = libcgraph.la pkgconfig_DATA = libcgraph.pc diff --git a/lib/cgraph/malloc.h b/lib/cgraph/include/malloc.h similarity index 100% rename from lib/cgraph/malloc.h rename to lib/cgraph/include/malloc.h diff --git a/lib/sfdpgen/PriorityQueue.c b/lib/sfdpgen/PriorityQueue.c index cc4803826..1c4c7072f 100644 --- a/lib/sfdpgen/PriorityQueue.c +++ b/lib/sfdpgen/PriorityQueue.c @@ -11,6 +11,8 @@ * Contributors: See CVS logs. Details at http://www.graphviz.org/ *************************************************************************/ +#include + #include "LinkedList.h" #include "PriorityQueue.h" #include "memory.h" @@ -18,12 +20,6 @@ #include "assert.h" #include "arith.h" -#define MALLOC gmalloc -#define REALLOC grealloc -#define FREE free -#define MEMCPY memcpy - - PriorityQueue PriorityQueue_new(int n, int ngain){ PriorityQueue q; int i; @@ -50,15 +46,15 @@ void PriorityQueue_delete(PriorityQueue q){ if (q){ if (q->buckets){ for (i = 0; i < q->ngain+1; i++) DoubleLinkedList_delete((q->buckets)[i], free); - FREE(q->buckets); + free(q->buckets); } if (q->where){ - FREE(q->where); + free(q->where); } - FREE(q->gain); - FREE(q); + free(q->gain); + free(q); } } -- 2.40.0