summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--config.h.cmake1
-rw-r--r--src/core/wee-command.c8
3 files changed, 10 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1dd3ae1ab..76dbd39dd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -192,6 +192,7 @@ include(CheckSymbolExists)
check_include_files("langinfo.h" HAVE_LANGINFO_CODESET)
check_include_files("sys/resource.h" HAVE_SYS_RESOURCE_H)
+check_symbol_exists("malloc_trim" "malloc.h" HAVE_MALLOC_TRIM)
check_function_exists(mallinfo HAVE_MALLINFO)
check_function_exists(mallinfo2 HAVE_MALLINFO2)
diff --git a/config.h.cmake b/config.h.cmake
index a9010448d..edd876469 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -5,6 +5,7 @@
#cmakedefine ICONV_2ARG_IS_CONST 1
#cmakedefine HAVE_MALLINFO
#cmakedefine HAVE_MALLINFO2
+#cmakedefine HAVE_MALLOC_TRIM
#cmakedefine HAVE_EAT_NEWLINE_GLITCH
#cmakedefine HAVE_ASPELL_VERSION_STRING
#cmakedefine HAVE_ENCHANT_GET_VERSION
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index 5ea433b54..4d468078b 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -6767,6 +6767,7 @@ COMMAND_CALLBACK(sys)
if (string_strcmp (argv[1], "malloc_trim") == 0)
{
+#ifdef HAVE_MALLOC_TRIM
error = NULL;
value = 0;
if (argc > 2)
@@ -6776,6 +6777,13 @@ COMMAND_CALLBACK(sys)
COMMAND_ERROR;
}
malloc_trim ((size_t)value);
+#else
+ gui_chat_printf (NULL,
+ _("%sFunction \"%s\" is not available on "
+ "this system"),
+ gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
+ "malloc_trim");
+#endif
return WEECHAT_RC_OK;
}