Browse Source

Make malloc_stats() GNU libc compatible

This fix commit 76dfc7ce8c "Some requested additional malloc entry points"
from 2004's

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Waldemar Brodkorb 8 years ago
parent
commit
b6af57f980
2 changed files with 4 additions and 9 deletions
  1. 2 3
      include/malloc.h
  2. 2 6
      libc/stdlib/malloc-standard/mallinfo.c

+ 2 - 3
include/malloc.h

@@ -159,9 +159,8 @@ extern int malloc_trim(size_t pad);
 # endif /* __USE_GNU */
 
 #include <stdio.h>
-/* Prints brief summary statistics to the specified file.
- * Writes to stderr if file is NULL. */
-extern void malloc_stats(FILE *file);
+/* Prints brief summary statistics on the stderr. */
+extern void malloc_stats(void);
 
 /* SVID2/XPG mallopt options */
 #ifndef M_MXFAST

+ 2 - 6
libc/stdlib/malloc-standard/mallinfo.c

@@ -81,16 +81,12 @@ struct mallinfo mallinfo(void)
 }
 libc_hidden_def(mallinfo)
 
-void malloc_stats(FILE *file)
+void malloc_stats(void)
 {
     struct mallinfo mi;
 
-    if (file==NULL) {
-	file = stderr;
-    }
-
     mi = mallinfo();
-    fprintf(file,
+    fprintf(stderr,
 	    "total bytes allocated             = %10u\n"
 	    "total bytes in use bytes          = %10u\n"
 	    "total non-mmapped bytes allocated = %10d\n"