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;
          |                               ^~~~~~~~~~
This commit is contained in:
Michal Nowak 2026-05-19 21:06:38 +02:00
parent 222d86fee8
commit 075305dcc7

View file

@ -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();