[gnome-shell] Check for availability of mallinfo()



commit 68bc5baf12ffb6d91f5d8b60ca7cc5360e08cd67
Author: Koop Mast <kwm FreeBSD org>
Date:   Mon Jun 7 10:36:21 2010 -0400

    Check for availability of mallinfo()
    
    Fixes the build on FreeBSD.
    
    Signed-off-by: Colin Walters <walters verbum org>

 configure.ac             |    1 +
 src/gnome-shell-plugin.c |    4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index daf6cc4..34df13b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,6 +104,7 @@ AC_SUBST(GJS_JS_NATIVE_DIR)
 AC_SUBST(GJS_CONSOLE)
 
 AC_CHECK_FUNCS(fdwalk)
+AC_CHECK_FUNCS(mallinfo)
 AC_CHECK_HEADERS([sys/resource.h])
 
 # Sets GLIB_GENMARSHAL and GLIB_MKENUMS
diff --git a/src/gnome-shell-plugin.c b/src/gnome-shell-plugin.c
index 2951cb2..8358a35 100644
--- a/src/gnome-shell-plugin.c
+++ b/src/gnome-shell-plugin.c
@@ -38,7 +38,9 @@
 #include <gjs/gjs.h>
 #include <girepository.h>
 #include <gmodule.h>
+#ifdef HAVE_MALLINFO
 #include <malloc.h>
+#endif
 #include <stdlib.h>
 #include <string.h>
 
@@ -246,6 +248,7 @@ static void
 malloc_statistics_callback (ShellPerfLog *perf_log,
                             gpointer      data)
 {
+#ifdef HAVE_MALLINFO
   struct mallinfo info = mallinfo ();
 
   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,
                                      "malloc.usedSize",
                                      info.uordblks);
+#endif
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]