Protect use of mallinfo in #ifdef __GLIBC__ blocks

This commit is contained in:
Maxime Coste 2015-01-12 19:55:58 +00:00
parent e8b8070536
commit c8d651a517

View File

@ -29,7 +29,10 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#if defined(__GLIBC__)
#include <malloc.h> #include <malloc.h>
#endif
namespace Kakoune namespace Kakoune
{ {
@ -835,7 +838,9 @@ const CommandDesc debug_cmd = {
write_debug(domain_name((MemoryDomain)domain) + (": " + to_string(count))); write_debug(domain_name((MemoryDomain)domain) + (": " + to_string(count)));
} }
write_debug("Total: " + to_string(total)); write_debug("Total: " + to_string(total));
#if defined(__GLIBC__)
write_debug("Malloced: " + to_string(mallinfo().uordblks)); write_debug("Malloced: " + to_string(mallinfo().uordblks));
#endif
} }
else else
throw runtime_error("unknown debug command '" + parser[0] + "'"); throw runtime_error("unknown debug command '" + parser[0] + "'");