From: Matthew Fernandez Date: Sat, 6 Jun 2020 19:50:06 +0000 (-0700) Subject: remove dmalloc support X-Git-Tag: 2.44.1~4^2~11^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=55d3a3f623a3c7de4a2890823b9b2685b5155588;p=graphviz remove dmalloc support Dmalloc is a library for debugging allocation problems [0]. Though it can be useful, these days its functionality is subsumed by Valgrind and Address Sanitizer. These two are simpler to use and more precise/detailed than dmalloc. [0]: https://dmalloc.com/ --- diff --git a/lib/cgraph/refstr.c b/lib/cgraph/refstr.c index 0144ccfaf..70a7e05e1 100644 --- a/lib/cgraph/refstr.c +++ b/lib/cgraph/refstr.c @@ -13,10 +13,6 @@ #include -#ifdef DMALLOC -#include "dmalloc.h" -#endif - /* * reference counted strings. */ diff --git a/lib/common/memory.h b/lib/common/memory.h index 1a0b3466a..1f0c53c91 100644 --- a/lib/common/memory.h +++ b/lib/common/memory.h @@ -23,15 +23,6 @@ extern "C" { #endif -#ifdef DMALLOC -#define NEW(t) (t*)calloc(1,sizeof(t)) -#define N_NEW(n,t) (t*)calloc((n),sizeof(t)) -#define GNEW(t) (t*)malloc(sizeof(t)) -#define N_GNEW(n,t) (t*)malloc((n)*sizeof(t)) -#define ALLOC(size,ptr,type) (ptr? (type*)realloc(ptr,(size)*sizeof(type)):(type*)malloc((size)*sizeof(type))) -#define RALLOC(size,ptr,type) ((type*)realloc(ptr,(size)*sizeof(type))) -#define ZALLOC(size,ptr,type,osize) (ptr? (type*)recalloc(ptr,(size)*sizeof(type)):(type*)calloc((size),sizeof(type))) -#else #define NEW(t) (t*)zmalloc(sizeof(t)) #define N_NEW(n,t) (t*)zmalloc((n)*sizeof(t)) #define GNEW(t) (t*)gmalloc(sizeof(t)) @@ -41,7 +32,6 @@ extern "C" { #define ALLOC(size,ptr,type) (ptr? (type*)grealloc(ptr,(size)*sizeof(type)):(type*)gmalloc((size)*sizeof(type))) #define RALLOC(size,ptr,type) ((type*)grealloc(ptr,(size)*sizeof(type))) #define ZALLOC(size,ptr,type,osize) (ptr? (type*)zrealloc(ptr,size,sizeof(type),osize):(type*)zmalloc((size)*sizeof(type))) -#endif #ifdef GVDLL #define extern __declspec(dllexport) #else diff --git a/lib/graph/attribs.c b/lib/graph/attribs.c index 8a58a0431..f9bb9d9c3 100644 --- a/lib/graph/attribs.c +++ b/lib/graph/attribs.c @@ -16,10 +16,6 @@ #define EXTERN #include "libgraph.h" -#ifdef DMALLOC -#include "dmalloc.h" -#endif - Agdict_t *agdictof(void *obj) { Agdict_t *d = NULL; diff --git a/lib/graph/edge.c b/lib/graph/edge.c index 6627d60cc..490eee0b8 100644 --- a/lib/graph/edge.c +++ b/lib/graph/edge.c @@ -15,10 +15,6 @@ #include "libgraph.h" -#ifdef DMALLOC -#include "dmalloc.h" -#endif - #if 0 /* graphs_of_e() is never used - suppress compiler warnings. */ static void graphs_of_e(Agedge_t * e, Dict_t * g_e, Agraph_t * g) diff --git a/lib/graph/graph.c b/lib/graph/graph.c index 861512a1f..bba49568b 100644 --- a/lib/graph/graph.c +++ b/lib/graph/graph.c @@ -15,10 +15,6 @@ #include "libgraph.h" -#ifdef DMALLOC -#include "dmalloc.h" -#endif - Dtdisc_t agNamedisc = { offsetof(Agnode_t, name), -1, diff --git a/lib/graph/lexer.c b/lib/graph/lexer.c index ef62e0389..9df92553f 100644 --- a/lib/graph/lexer.c +++ b/lib/graph/lexer.c @@ -19,10 +19,6 @@ #include "triefa.cP" #include "agxbuf.h" -#ifdef DMALLOC -#include "dmalloc.h" -#endif - #define InfileName (InputFile?InputFile:"") static FILE *Lexer_fp; diff --git a/lib/graph/node.c b/lib/graph/node.c index 21a07b537..9afdd7bc1 100644 --- a/lib/graph/node.c +++ b/lib/graph/node.c @@ -15,10 +15,6 @@ #include "libgraph.h" -#ifdef DMALLOC -#include "dmalloc.h" -#endif - Agnode_t *agfindnode(Agraph_t * g, char *name) { Agnode_t *rv; diff --git a/lib/graph/parser.y b/lib/graph/parser.y index b53a563d2..28ba7a00b 100644 --- a/lib/graph/parser.y +++ b/lib/graph/parser.y @@ -15,10 +15,6 @@ #include "libgraph.h" -#ifdef DMALLOC -#include "dmalloc.h" -#endif - static char *Port; static char In_decl,In_edge_stmt; static int Current_class,Agraph_type; diff --git a/lib/graph/refstr.c b/lib/graph/refstr.c index f15c0cc86..1a0b2b3e1 100644 --- a/lib/graph/refstr.c +++ b/lib/graph/refstr.c @@ -18,10 +18,6 @@ static unsigned int HTML_BIT; static unsigned int CNT_BITS; -#ifdef DMALLOC -#include "dmalloc.h" -#endif - typedef struct refstr_t { Dtlink_t link; unsigned int refcnt; diff --git a/lib/graph/trie.c b/lib/graph/trie.c index bf0cc03c1..ae94e35d1 100644 --- a/lib/graph/trie.c +++ b/lib/graph/trie.c @@ -16,10 +16,6 @@ #include "parser.h" #include "triefa.h" -#ifdef DMALLOC -#include "dmalloc.h" -#endif - TrieState TrieStateTbl[34] = { {-1, 0, 0x42058} , diff --git a/lib/pathplan/cvt.c b/lib/pathplan/cvt.c index f5115d33d..5d22194d1 100644 --- a/lib/pathplan/cvt.c +++ b/lib/pathplan/cvt.c @@ -15,10 +15,6 @@ #include #include "vis.h" -#ifdef DMALLOC -#include "dmalloc.h" -#endif - typedef Ppoint_t ilcoord_t; #ifdef DEBUG diff --git a/lib/pathplan/inpoly.c b/lib/pathplan/inpoly.c index d508e6685..192d1ccea 100644 --- a/lib/pathplan/inpoly.c +++ b/lib/pathplan/inpoly.c @@ -22,10 +22,6 @@ #include "vispath.h" #include "pathutil.h" -#ifdef DMALLOC -#include "dmalloc.h" -#endif - int in_poly(Ppoly_t poly, Ppoint_t q) { int i, i1; /* point index; i1 = i-1 mod n */ diff --git a/lib/pathplan/route.c b/lib/pathplan/route.c index 5ab2863f2..0a16c61e0 100644 --- a/lib/pathplan/route.c +++ b/lib/pathplan/route.c @@ -22,10 +22,6 @@ #include "pathutil.h" #include "solvers.h" -#ifdef DMALLOC -#include "dmalloc.h" -#endif - #define EPSILON1 1E-3 #define EPSILON2 1E-6 diff --git a/lib/pathplan/shortest.c b/lib/pathplan/shortest.c index e0c84128b..2a81b7623 100644 --- a/lib/pathplan/shortest.c +++ b/lib/pathplan/shortest.c @@ -22,10 +22,6 @@ #include #include "pathutil.h" -#ifdef DMALLOC -#include "dmalloc.h" -#endif - #define ISCCW 1 #define ISCW 2 #define ISON 3 diff --git a/lib/pathplan/shortestpth.c b/lib/pathplan/shortestpth.c index 85b49b4bf..1d6bd0f59 100644 --- a/lib/pathplan/shortestpth.c +++ b/lib/pathplan/shortestpth.c @@ -14,10 +14,6 @@ #include "vis.h" -#ifdef DMALLOC -#include "dmalloc.h" -#endif - static COORD unseen = (double) INT_MAX; /* shortestPath: diff --git a/lib/pathplan/solvers.c b/lib/pathplan/solvers.c index e3f6571ab..619f58dc5 100644 --- a/lib/pathplan/solvers.c +++ b/lib/pathplan/solvers.c @@ -16,10 +16,6 @@ #include #include "solvers.h" -#ifdef DMALLOC -#include "dmalloc.h" -#endif - #ifndef HAVE_CBRT #define cbrt(x) ((x < 0) ? (-1*pow(-x, 1.0/3.0)) : pow (x, 1.0/3.0)) #endif diff --git a/lib/pathplan/triang.c b/lib/pathplan/triang.c index 71d22d4ec..728024312 100644 --- a/lib/pathplan/triang.c +++ b/lib/pathplan/triang.c @@ -19,10 +19,6 @@ #include "pathutil.h" #include "tri.h" -#ifdef DMALLOC -#include "dmalloc.h" -#endif - typedef struct lvertex_2_t { double x, y; } lvertex_2_t; diff --git a/lib/pathplan/util.c b/lib/pathplan/util.c index e2d31ce10..5fabe03d6 100644 --- a/lib/pathplan/util.c +++ b/lib/pathplan/util.c @@ -16,10 +16,6 @@ #include #include "pathutil.h" -#ifdef DMALLOC -#include "dmalloc.h" -#endif - #define ALLOC(size,ptr,type) (ptr? (type*)realloc(ptr,(size)*sizeof(type)):(type*)malloc((size)*sizeof(type))) Ppoly_t copypoly(Ppoly_t argpoly) diff --git a/lib/pathplan/visibility.c b/lib/pathplan/visibility.c index ac5743077..d971ffd77 100644 --- a/lib/pathplan/visibility.c +++ b/lib/pathplan/visibility.c @@ -14,10 +14,6 @@ #include "vis.h" -#ifdef DMALLOC -#include "dmalloc.h" -#endif - /* TRANSPARENT means router sees past colinear obstacles */ #ifdef TRANSPARENT #define INTERSECT(a,b,c,d,e) intersect1((a),(b),(c),(d),(e)) diff --git a/lib/rbtree/Makefile.am b/lib/rbtree/Makefile.am index c940cbaf2..80778ddc2 100644 --- a/lib/rbtree/Makefile.am +++ b/lib/rbtree/Makefile.am @@ -11,4 +11,4 @@ librbtree_C_la_SOURCES = misc.c red_black_tree.c stack.c CLEANFILES = inkpot_lib_*.dat EXTRA_DIST = LICENSE CHANGES makefile.txt test_red_black_tree.c \ - simple_test.sh test_rb rbtree.vcxproj* + test_rb rbtree.vcxproj* diff --git a/lib/rbtree/makefile.txt b/lib/rbtree/makefile.txt index cf77a1013..133e9e107 100755 --- a/lib/rbtree/makefile.txt +++ b/lib/rbtree/makefile.txt @@ -1,10 +1,6 @@ # prompt> make # builds everything and links in test program test_rb -# -# prompt> make mem_check -# Rebuilds everything using dmalloc and does memory testing. -# Only works if you have dmalloc installed (see http://dmalloc.com). SRCS = test_red_black_tree.c red_black_tree.c stack.c misc.c @@ -18,35 +14,12 @@ CFLAGS = -g -Wall -pedantic PROGRAM = test_rb -.PHONY: mem_check clean +.PHONY: clean all: $(PROGRAM) $(PROGRAM): $(OBJS) - $(CC) $(CFLAGS) $(OBJS) -o $(PROGRAM) $(DMALLOC_LIB) - -mem_check: - @if [ -e makefile.txt ] ; then \ - echo "Using makefile.txt" ; \ - $(MAKE) clean -f makefile.txt ; \ - $(MAKE) $(PROGRAM) "CFLAGS=$(CFLAGS) -DDMALLOC" "DMALLOC_LIB=-ldmalloc" -f makefile.txt ; \ - else \ - echo "Using default makefile (i.e. no -f flag)." ; \ - $(MAKE) clean ; \ - $(MAKE) $(PROGRAM) "CFLAGS=$(CFLAGS) -DDMALLOC" "DMALLOC_LIB=-ldmalloc" ; \ - fi - ./simple_test.sh - @if [ -s unfreed.txt ] ; then \ - echo " " ; \ - echo "Leaked some memory. See logfile for details." ;\ - else \ - echo " " ; \ - echo "No memory leaks detected. " ;\ - echo " " ; \ - echo "Test passed. " ; \ - echo " " ; \ - fi - + $(CC) $(CFLAGS) $(OBJS) -o $(PROGRAM) test_red_black_tree.o: test_red_black_tree.c red_black_tree.c stack.c stack.h red_black_tree.h misc.h diff --git a/lib/rbtree/red_black_tree.h b/lib/rbtree/red_black_tree.h index ba822a564..2496f542c 100644 --- a/lib/rbtree/red_black_tree.h +++ b/lib/rbtree/red_black_tree.h @@ -12,9 +12,6 @@ extern "C" { #endif -#ifdef DMALLOC -#include -#endif #include "misc.h" #include "stack.h" diff --git a/lib/rbtree/simple_test.sh b/lib/rbtree/simple_test.sh deleted file mode 100755 index 8610c70d7..000000000 --- a/lib/rbtree/simple_test.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -eval `dmalloc -l logfile -i 100 high` -./test_rb< -#ifdef DMALLOC -#include "dmalloc.h" -#endif - - /* * Variable set to contain the alignment factor (in bytes) for this machine. * It is set on the first table initialization.