Check for availability of mallinfo()

Fixes the build on FreeBSD.

Signed-off-by: Colin Walters <walters@verbum.org>
This commit is contained in:
Koop Mast 2010-06-07 10:36:21 -04:00 committed by Colin Walters
parent 8da5c5f50e
commit 68bc5baf12
2 changed files with 5 additions and 0 deletions

View File

@ -104,6 +104,7 @@ AC_SUBST(GJS_JS_NATIVE_DIR)
AC_SUBST(GJS_CONSOLE) AC_SUBST(GJS_CONSOLE)
AC_CHECK_FUNCS(fdwalk) AC_CHECK_FUNCS(fdwalk)
AC_CHECK_FUNCS(mallinfo)
AC_CHECK_HEADERS([sys/resource.h]) AC_CHECK_HEADERS([sys/resource.h])
# Sets GLIB_GENMARSHAL and GLIB_MKENUMS # Sets GLIB_GENMARSHAL and GLIB_MKENUMS

View File

@ -38,7 +38,9 @@
#include <gjs/gjs.h> #include <gjs/gjs.h>
#include <girepository.h> #include <girepository.h>
#include <gmodule.h> #include <gmodule.h>
#ifdef HAVE_MALLINFO
#include <malloc.h> #include <malloc.h>
#endif
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -246,6 +248,7 @@ static void
malloc_statistics_callback (ShellPerfLog *perf_log, malloc_statistics_callback (ShellPerfLog *perf_log,
gpointer data) gpointer data)
{ {
#ifdef HAVE_MALLINFO
struct mallinfo info = mallinfo (); struct mallinfo info = mallinfo ();
shell_perf_log_update_statistic_i (perf_log, shell_perf_log_update_statistic_i (perf_log,
@ -257,6 +260,7 @@ malloc_statistics_callback (ShellPerfLog *perf_log,
shell_perf_log_update_statistic_i (perf_log, shell_perf_log_update_statistic_i (perf_log,
"malloc.usedSize", "malloc.usedSize",
info.uordblks); info.uordblks);
#endif
} }
static void static void