about summary refs log tree commit diff
path: root/malloc
diff options
context:
space:
mode:
Diffstat (limited to 'malloc')
-rw-r--r--malloc/Makefile4
-rw-r--r--malloc/mcheck.h23
-rw-r--r--malloc/mtrace.c2
-rw-r--r--malloc/mtrace.pl9
4 files changed, 14 insertions, 24 deletions
diff --git a/malloc/Makefile b/malloc/Makefile
index 8a7fe14d92..ca651d6b03 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -24,10 +24,10 @@ subdir	:= malloc
 all:
 
 dist-headers := malloc.h
-headers := $(dist-headers) obstack.h
+headers := $(dist-headers) obstack.h mcheck.h
 tests := mallocbug
 
-distribute = thread-m.h mtrace.pl mcheck-init.c mcheck.h
+distribute = thread-m.h mtrace.pl mcheck-init.c
 
 # Things which get pasted together into gmalloc.c.
 gmalloc-routines := malloc morecore
diff --git a/malloc/mcheck.h b/malloc/mcheck.h
index 17ab0a9ced..d793bfc3dc 100644
--- a/malloc/mcheck.h
+++ b/malloc/mcheck.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -19,22 +19,9 @@
 #ifndef _MCHECK_H
 #define _MCHECK_H	1
 
-#ifdef  __cplusplus
-extern "C" {
-#endif
-
-#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
-#undef  __P
-#define __P(args)       args
-#undef  __ptr_t
-#define __ptr_t         void *
-#else /* Not C++ or ANSI C.  */
-#undef  __P
-#define __P(args)       ()
-#undef  __ptr_t
-#define __ptr_t         char *
-#endif /* C++ or ANSI C.  */
+#include <features.h>
 
+__BEGIN_DECLS
 
 /* Return values for `mprobe': these are the kinds of inconsistencies that
    `mcheck' enables detection of.  */
@@ -63,8 +50,6 @@ extern enum mcheck_status mprobe __P ((__ptr_t __ptr));
 extern void mtrace __P ((void));
 extern void muntrace __P ((void));
 
-#ifdef  __cplusplus
-}
-#endif
+__END_DECLS
 
 #endif /* mcheck.h */
diff --git a/malloc/mtrace.c b/malloc/mtrace.c
index c1704d00ea..cdd7432a76 100644
--- a/malloc/mtrace.c
+++ b/malloc/mtrace.c
@@ -41,7 +41,7 @@ extern char *getenv ();
 #endif
 
 static FILE *mallstream;
-static char mallenv[]= "MALLOC_TRACE";
+static const char mallenv[]= "MALLOC_TRACE";
 static char mallbuf[BUFSIZ];	/* Buffer for the output.  */
 
 __libc_lock_define_initialized (static, lock);
diff --git a/malloc/mtrace.pl b/malloc/mtrace.pl
index 46d8425bee..f889294c1d 100644
--- a/malloc/mtrace.pl
+++ b/malloc/mtrace.pl
@@ -178,15 +178,20 @@ close (DATA);
 
 # Now print all remaining entries.
 @addrs= keys %allocated;
+$anything=0;
 if ($#addrs >= 0) {
-    print "\nNot freed memory:\n-----------------\n";
-    print ' ' x (@XXX@ - 7), "Address     Size     Caller\n";
     foreach $addr (sort @addrs) {
 	if (defined $allocated{$addr}) {
+	    if ($anything == 0) {
+		print "\nMemory not freed:\n-----------------\n";
+		print ' ' x (@XXX@ - 7), "Address     Size     Caller\n";
+		$anything=1;
+	    }
 	    printf ("%#0@XXX@x %#8x  at %s\n", hex($addr), $allocated{$addr},
 		    $wherewas{$addr});
 	}
     }
 }
+print "No memory leaks.\n" if ($anything == 0);
 
 exit 0;