From e8e6ca630934ff2fa5581aced1dc0dad110d8b40 Mon Sep 17 00:00:00 2001 From: Yossi Gottlieb Date: Sun, 7 Mar 2021 14:14:23 +0200 Subject: [PATCH] Fix FreeBSD <12.x builds. (#8603) --- src/zmalloc.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/zmalloc.h b/src/zmalloc.h index d44c7b389..3c0ba95d4 100644 --- a/src/zmalloc.h +++ b/src/zmalloc.h @@ -71,12 +71,21 @@ */ #ifndef ZMALLOC_LIB #define ZMALLOC_LIB "libc" + #if !defined(NO_MALLOC_USABLE_SIZE) && \ (defined(__GLIBC__) || defined(__FreeBSD__) || \ defined(USE_MALLOC_USABLE_SIZE)) + +/* Includes for malloc_usable_size() */ +#ifdef __FreeBSD__ +#include +#else #include +#endif + #define HAVE_MALLOC_SIZE 1 #define zmalloc_size(p) malloc_usable_size(p) + #endif #endif