should fix builds for osx

This commit is contained in:
Campbell Barton 2013-08-28 11:22:29 +00:00
parent d1d6a13297
commit 1a6b364c28

@ -49,8 +49,9 @@
#endif #endif
/* only for utility functions */ /* only for utility functions */
#if defined(__GNUC__) #if defined(__GNUC__) && defined(__linux__)
#include <malloc.h> #include <malloc.h>
# define HAVE_MALLOC_H
#endif #endif
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
@ -625,7 +626,7 @@ void MEM_printmemlist_stats(void)
MemHead *membl; MemHead *membl;
MemPrintBlock *pb, *printblock; MemPrintBlock *pb, *printblock;
int totpb, a, b; int totpb, a, b;
#ifdef __GNUC__ #ifdef HAVE_MALLOC_H
size_t mem_in_use_slop; size_t mem_in_use_slop;
#endif #endif
mem_lock_thread(); mem_lock_thread();
@ -647,7 +648,7 @@ void MEM_printmemlist_stats(void)
totpb++; totpb++;
pb++; pb++;
#ifdef __GNUC__ #ifdef HAVE_MALLOC_H
mem_in_use_slop += (sizeof(MemHead) + sizeof(MemTail) + mem_in_use_slop += (sizeof(MemHead) + sizeof(MemTail) +
malloc_usable_size((void *)membl)) - membl->len; malloc_usable_size((void *)membl)) - membl->len;
#endif #endif
@ -680,7 +681,7 @@ void MEM_printmemlist_stats(void)
(double)mem_in_use / (double)(1024 * 1024)); (double)mem_in_use / (double)(1024 * 1024));
printf("peak memory len: %.3f MB\n", printf("peak memory len: %.3f MB\n",
(double)peak_mem / (double)(1024 * 1024)); (double)peak_mem / (double)(1024 * 1024));
#ifdef __GNUC__ #ifdef HAVE_MALLOC_H
printf("slop memory len: %.3f MB\n", printf("slop memory len: %.3f MB\n",
(double)mem_in_use_slop / (double)(1024 * 1024)); (double)mem_in_use_slop / (double)(1024 * 1024));
#endif #endif
@ -694,7 +695,8 @@ void MEM_printmemlist_stats(void)
mem_unlock_thread(); mem_unlock_thread();
#if 0 /* GLIBC only */ #ifdef HAVE_MALLOC_H /* GLIBC only */
printf("System Statistics:\n");
malloc_stats(); malloc_stats();
#endif #endif
} }