]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Forward declare mallocx in isc/mem.h
authorAydın Mercan <aydin@isc.org>
Thu, 4 Jan 2024 07:40:54 +0000 (10:40 +0300)
committerOndřej Surý <ondrej@isc.org>
Thu, 18 Jan 2024 08:34:36 +0000 (09:34 +0100)
cmocka.h and jemalloc.h/malloc_np.h has conflicting macro definitions.
While fixing them with push_macro for only malloc is done below, we only
need the non-standard mallocx interface which is easy to just define by
ourselves.

lib/isc/include/isc/mem.h

index b7143bdbddba7cb030b90546460ff7fe65bc1109..2ee8c9e20027ead50aa7364e9e2db4646c42dc4a 100644 (file)
@@ -190,14 +190,20 @@ extern unsigned int isc_mem_defaultflags;
  * for more information.
  */
 #if HAVE_JEMALLOC
-#include <jemalloc/jemalloc.h>
+
+/*
+ * cmocka.h has confliction definitions with the jemalloc header but we only
+ * need the mallocx symbol from jemalloc.
+ */
+void *
+mallocx(size_t size, int flags);
 
 extern volatile void *isc__mem_malloc;
 
-#define isc_mem_create(cp)                                        \
-       {                                                         \
-               isc__mem_create((cp)_ISC_MEM_FILELINE);           \
-               isc__mem_malloc = mallocx;                        \
+#define isc_mem_create(cp)                                            \
+       {                                                             \
+               isc__mem_create((cp)_ISC_MEM_FILELINE);               \
+               isc__mem_malloc = mallocx;                            \
                ISC_INSIST(CMM_ACCESS_ONCE(isc__mem_malloc) != NULL); \
        }
 #else