]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Took into account that mallinfo() is not supported on all platforms.
authorBart Van Assche <bvanassche@acm.org>
Tue, 22 Apr 2008 17:25:29 +0000 (17:25 +0000)
committerBart Van Assche <bvanassche@acm.org>
Tue, 22 Apr 2008 17:25:29 +0000 (17:25 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7907

memcheck/tests/mallinfo.c

index b8a281bd1f1bb14f51b9fb8b2ba99a84d85f15ef..5ff258e8e67206a3a62c547564efb1316bc2b554 100644 (file)
@@ -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 @@ 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)
 {