Bug 778056 - malloc_usable_size is also available in libc on FreeBSD, so use it in mozalloc.cpp. r=jlebar

This commit is contained in:
Jan Beich 2012-07-27 14:14:39 -04:00
parent 2a90ed1ba7
commit 9caaae5480

View File

@ -19,6 +19,9 @@
#if defined(XP_UNIX) #if defined(XP_UNIX)
# include <unistd.h> // for valloc on *BSD # include <unistd.h> // for valloc on *BSD
#endif //if defined(XP_UNIX) #endif //if defined(XP_UNIX)
#if defined(__FreeBSD__)
# include <malloc_np.h> // for malloc_usable_size
#endif // if defined(__FreeBSD__)
#if defined(XP_WIN) || (defined(XP_OS2) && defined(__declspec)) #if defined(XP_WIN) || (defined(XP_OS2) && defined(__declspec))
# define MOZALLOC_EXPORT __declspec(dllexport) # define MOZALLOC_EXPORT __declspec(dllexport)
@ -210,7 +213,7 @@ moz_malloc_usable_size(void *ptr)
#if defined(XP_MACOSX) #if defined(XP_MACOSX)
return malloc_size(ptr); return malloc_size(ptr);
#elif defined(MOZ_MEMORY) || (defined(XP_LINUX) && !defined(ANDROID)) #elif defined(MOZ_MEMORY) || (defined(XP_LINUX) && !defined(ANDROID)) || defined(__FreeBSD__)
// Android bionic libc doesn't have malloc_usable_size. // Android bionic libc doesn't have malloc_usable_size.
return malloc_usable_size(ptr); return malloc_usable_size(ptr);
#elif defined(XP_WIN) #elif defined(XP_WIN)