]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Move last_purge declaration under the same #ifdef as its user 12058/head
authorMichal Nowak <mnowak@isc.org>
Tue, 19 May 2026 19:06:38 +0000 (21:06 +0200)
committerMichal Nowak <mnowak@isc.org>
Thu, 21 May 2026 13:10:20 +0000 (15:10 +0200)
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

index 2ef4e2858341f2ae2f845b09d8d4b64346641642..70c8b6b86e2604ec7b8621eb9e888b2b0c34c980 100644 (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();