]> granicus.if.org Git - graphviz/commitdiff
remove dmalloc support
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 6 Jun 2020 19:50:06 +0000 (12:50 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 6 Jun 2020 19:50:06 +0000 (12:50 -0700)
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/

24 files changed:
lib/cgraph/refstr.c
lib/common/memory.h
lib/graph/attribs.c
lib/graph/edge.c
lib/graph/graph.c
lib/graph/lexer.c
lib/graph/node.c
lib/graph/parser.y
lib/graph/refstr.c
lib/graph/trie.c
lib/pathplan/cvt.c
lib/pathplan/inpoly.c
lib/pathplan/route.c
lib/pathplan/shortest.c
lib/pathplan/shortestpth.c
lib/pathplan/solvers.c
lib/pathplan/triang.c
lib/pathplan/util.c
lib/pathplan/visibility.c
lib/rbtree/Makefile.am
lib/rbtree/makefile.txt
lib/rbtree/red_black_tree.h
lib/rbtree/simple_test.sh [deleted file]
tclpkg/tclhandle/tclhandle.c

index 0144ccfaff1202b3c6847c5230dcfd99b7b9f284..70a7e05e13010fd47c1e6974cf96902ea458f979 100644 (file)
 
 #include <cghdr.h>
 
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
 /*
  * reference counted strings.
  */
index 1a0b3466ac963f890abd7b8376f660662822a8e6..1f0c53c919d45a7a11341f743892f7d1391a3aa1 100644 (file)
 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
index 8a58a0431e63bdcb9dec7ccfd504862bfd52bb93..f9bb9d9c3112aad5d3b6172c12906fd33f45c38a 100644 (file)
 #define EXTERN
 #include "libgraph.h"
 
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
 Agdict_t *agdictof(void *obj)
 {
     Agdict_t *d = NULL;
index 6627d60cce8a197110137b78a28fb1db3f2c646f..490eee0b815fba577f18de6651f30b98afdd5f4c 100644 (file)
 
 #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)
index 861512a1f72ae1ec30b8043a2bacc8c422bf8212..bba49568b01bfe5599a338a0412d4cbd477d5427 100644 (file)
 
 #include "libgraph.h"
 
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
 Dtdisc_t agNamedisc = {
     offsetof(Agnode_t, name),
     -1,
index ef62e0389ed54e2345ca22a2a9d3f3d89843faa0..9df92553f55c81a1c7e05c08327457e0471352c1 100644 (file)
 #include "triefa.cP"
 #include "agxbuf.h"
 
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
 #define InfileName (InputFile?InputFile:"<unknown>")
 
 static FILE *Lexer_fp;
index 21a07b5375e459a873418dd7e4a8c6c63a345a62..9afdd7bc1cc567ab89517b790d0d3ff490da7e0a 100644 (file)
 
 #include "libgraph.h"
 
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
 Agnode_t *agfindnode(Agraph_t * g, char *name)
 {
     Agnode_t *rv;
index b53a563d2c996cec15a9bf31a98a2e2c2e465d34..28ba7a00b214dab235f91ef058fb4453d7deb6be 100644 (file)
 
 #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;
index f15c0cc86abe2d91b8ceb9dfb7c243020aabbeb0..1a0b2b3e194261959943a7ace9172a96a49e4756 100644 (file)
 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;
index bf0cc03c105ba3baec9db6777ccb996a83db3727..ae94e35d123909dd72cd9575dfc1c09c06422a07 100644 (file)
 #include "parser.h"
 #include "triefa.h"
 
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
 TrieState TrieStateTbl[34] = {
     {-1, 0, 0x42058}
     ,
index f5115d33d8541989e0876a11fca0e3ef79a5813b..5d22194d145c4eeede5d4f681c4e87d07ea56e31 100644 (file)
 #include <stdio.h>
 #include "vis.h"
 
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
 typedef Ppoint_t ilcoord_t;
 
 #ifdef DEBUG
index d508e66853c08821f05c0a4567fcc311d3bf3cb7..192d1ccea4ab7e98c8868d1e1eb348f28887f076 100644 (file)
 #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 */
index 5ab2863f2e8b172a88d60ebfb68482f1f919f238..0a16c61e05b514ee159fd7d1f4a12b84ad201fc4 100644 (file)
 #include "pathutil.h"
 #include "solvers.h"
 
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
 #define EPSILON1 1E-3
 #define EPSILON2 1E-6
 
index e0c84128b15d77d7fe60393a2004aca5a7f5e4e6..2a81b7623a674434622de4609c9adb711741e69f 100644 (file)
 #include <math.h>
 #include "pathutil.h"
 
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
 #define ISCCW 1
 #define ISCW  2
 #define ISON  3
index 85b49b4bf3cfcceca52ac7058c63b79fcce95c49..1d6bd0f5925953e3fd77117cb0c5f3828c30b91c 100644 (file)
 
 #include "vis.h"
 
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
 static COORD unseen = (double) INT_MAX;
 
 /* shortestPath:
index e3f6571abb2bf887b82cda061910d1cfd1404c86..619f58dc5ce76da27321efb6684e92f34c319c17 100644 (file)
 #include <math.h>
 #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
index 71d22d4ecba223f3a42b0a761c286ceeb72b1021..7280243121c34ad79517eadeab45a7fe83397819 100644 (file)
 #include "pathutil.h"
 #include "tri.h"
 
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
 typedef struct lvertex_2_t {
     double x, y;
 } lvertex_2_t;
index e2d31ce10e1d5f711afefe8afefbcfeb665d02dc..5fabe03d6fa91b68c869e14f7062a464f70f647b 100644 (file)
 #include <stdlib.h>
 #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)
index ac5743077d943817f18dde35cc74faaab9804af6..d971ffd773697403e4e2a64ce262505dd54e2e75 100644 (file)
 
 #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))
index c940cbaf2bf0cd7b787cbd6274c5c5a013244826..80778ddc2c4194bb230e93ab86a52a20db89d6d8 100644 (file)
@@ -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*
index cf77a1013a4555bc768b2bb46cb62db970d4c42a..133e9e107041f850ee88495f20c841393c1e4f1b 100755 (executable)
@@ -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
 
index ba822a56430f8ff649eca5a20dfdfe8d1d1312b7..2496f542cf95302d29d26529819e580e840430a3 100644 (file)
@@ -12,9 +12,6 @@
 extern "C" {
 #endif
 
-#ifdef DMALLOC
-#include <dmalloc.h>
-#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 (executable)
index 8610c70..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/sh
-eval `dmalloc -l logfile -i 100 high`
-./test_rb<<EOF
-1
-1
-1
-2
-1
-3
-1
-4
-1
-5
-7
-1
-9
-1 
-11
-1 
--87
-3 
-10
-3 
--87
-3 
-6
-4 
-3
-3 
-99
-5 
-2
-5 
-99
-5 
-1
-6
--1
-10
-2
-2
-2
-4
-7
-8
-EOF
-
-grep "not freed" logfile | tee unfreed.txt
-
-echo "DMALLOC_OPTIONS were :"
-printenv DMALLOC_OPTIONS
-
-exit 0
\ No newline at end of file
index d28fcdee9302e76e9909321917573a7815d9c7c9..65eea83a8538be1c6c5c0931c9ef37b595e8205a 100644 (file)
 /* Added 2000-09-19 by KG for memcpy, ... decls */
 #include <string.h>
 
-#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.