From 7f033fa04b9909ee8779e4767bbb6e2456eb9245 Mon Sep 17 00:00:00 2001 From: Tim Niederhausen Date: Tue, 3 Oct 2017 19:47:50 +0200 Subject: [PATCH] Fix malloc result size detection on FreeBSD Instead of and malloc_size FreeBSD has and malloc_usable_size. see: https://www.freebsd.org/cgi/man.cgi?query=malloc_usable_size&manpath=FreeBSD+11.1-RELEASE+and+Ports --- include/libtorrent/buffer.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/libtorrent/buffer.hpp b/include/libtorrent/buffer.hpp index 9eb4b3fcc..2cd47238a 100644 --- a/include/libtorrent/buffer.hpp +++ b/include/libtorrent/buffer.hpp @@ -47,6 +47,8 @@ POSSIBILITY OF SUCH DAMAGE. #include #elif defined _MSC_VER #include +#elif defined __FreeBSD__ +#include #elif defined TORRENT_BSD #include #endif @@ -81,7 +83,7 @@ public: // the actual allocation may be larger than we requested. If so, let the // user take advantage of every single byte -#if defined __GLIBC__ +#if defined __GLIBC__ || defined __FreeBSD__ m_size = ::malloc_usable_size(m_begin); #elif defined _MSC_VER m_size = ::_msize(m_begin);