|
From: <sv...@va...> - 2008-04-22 17:25:31
|
Author: bart
Date: 2008-04-22 18:25:29 +0100 (Tue, 22 Apr 2008)
New Revision: 7907
Log:
Took into account that mallinfo() is not supported on all platforms.
Modified:
trunk/memcheck/tests/mallinfo.c
Modified: trunk/memcheck/tests/mallinfo.c
===================================================================
--- trunk/memcheck/tests/mallinfo.c 2008-04-22 17:24:31 UTC (rev 7906)
+++ trunk/memcheck/tests/mallinfo.c 2008-04-22 17:25:29 UTC (rev 7907)
@@ -2,10 +2,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h> // 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 @@
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 @@
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)
{
|