From bb0f687673adc43359434faa6829d2bb1da183ea Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 22 Apr 2008 17:25:29 +0000 Subject: [PATCH] Took into account that mallinfo() is not supported on all platforms. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7907 --- memcheck/tests/mallinfo.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/memcheck/tests/mallinfo.c b/memcheck/tests/mallinfo.c index b8a281bd1f..5ff258e8e6 100644 --- a/memcheck/tests/mallinfo.c +++ b/memcheck/tests/mallinfo.c @@ -2,10 +2,13 @@ #include #include #include // getopt() +#include "../config.h" static int s_quiet = 0; + +#if defined(HAVE_MALLINFO) static size_t check(size_t min, size_t max) { struct mallinfo mi; @@ -26,6 +29,7 @@ static size_t check(size_t min, size_t max) printf("fordblks = %d\n", mi.fordblks); /* total free space */ printf("keepcost = %d\n", mi.keepcost); /* top-most, releasable (via malloc_trim) space */ printf("(min = %zu, max = %zu)\n", min, max); + printf("\n"); } // size checks @@ -66,6 +70,17 @@ static size_t check(size_t min, size_t max) return used; } +#else +static size_t check(size_t min, size_t max) +{ + if (! s_quiet) + { + printf("mallinfo() is not supported on this platform.\n"); + printf("\n"); + } + return 0; +} +#endif int main(int argc, char** argv) { -- 2.47.3