BUILD: pools: fix backport of no-memory-trimming on non-linux OS
Commit 4bcff9ba4 in 2.5 ("MINOR: pools: add a new global option
"no-memory-trimming"") was missing some extra ifdefs for the cases
where the allocator doesn't have malloc_trim() and fails to build
on windows.
This must be backported to 2.4.
(cherry picked from commit a11c3b83e3a3689700b12551650d8f5a681db5fb)
Signed-off-by: Willy Tarreau <w@1wt.eu>
diff --git a/src/pool.c b/src/pool.c
index 1f116d5..75c67d0 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -671,6 +671,7 @@
}
#endif
+#if defined(HA_HAVE_MALLOC_TRIM)
/* config parser for global "no-memory-trimming" */
static int mem_parse_global_no_mem_trim(char **args, int section_type, struct proxy *curpx,
const struct proxy *defpx, const char *file, int line,
@@ -681,13 +682,16 @@
disable_trim = 1;
return 0;
}
+#endif
/* register global config keywords */
static struct cfg_kw_list mem_cfg_kws = {ILH, {
#ifdef DEBUG_FAIL_ALLOC
{ CFG_GLOBAL, "tune.fail-alloc", mem_parse_global_fail_alloc },
#endif
+#if defined(HA_HAVE_MALLOC_TRIM)
{ CFG_GLOBAL, "no-memory-trimming", mem_parse_global_no_mem_trim },
+#endif
{ 0, NULL, NULL }
}};