From 075305dcc7351e7802911fc3a448665acbe0a3ac Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Tue, 19 May 2026 21:06:38 +0200 Subject: [PATCH] Move last_purge declaration under the same #ifdef as its user The static atomic last_purge is only read and written from mem_purge(), which is compiled only when JEMALLOC_API_SUPPORTED or __GLIBC__ is defined. This used to fail on OpenBSD: ../lib/isc/mem.c:405:31: error: unused variable 'last_purge' [-Werror,-Wunused-variable] 405 | static _Atomic(isc_stdtime_t) last_purge = 0; | ^~~~~~~~~~ --- lib/isc/mem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/isc/mem.c b/lib/isc/mem.c index 2ef4e28583..70c8b6b86e 100644 --- a/lib/isc/mem.c +++ b/lib/isc/mem.c @@ -402,12 +402,13 @@ mem_get(isc_mem_t *ctx, size_t size, int flags) { } static thread_local size_t freed_bytes = 0; -static _Atomic(isc_stdtime_t) last_purge = 0; constexpr size_t purge_threshold = (16 * 1024 * 1024); #if defined(JEMALLOC_API_SUPPORTED) || defined(__GLIBC__) +static _Atomic(isc_stdtime_t) last_purge = 0; + static void mem_purge(void) { isc_stdtime_t now = isc_stdtime_now();