1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

core: check that function malloc_trim is available, display an error if not available

This commit is contained in:
Sébastien Helleu
2024-03-06 22:36:37 +01:00
parent a1bee89ecc
commit 68598de958
3 changed files with 10 additions and 0 deletions
+1
View File
@@ -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)
+1
View File
@@ -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
+8
View File
@@ -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;
}