From: Willy Tarreau Date: Mon, 24 Jan 2022 14:44:26 +0000 (+0100) Subject: MINOR: pools: prepare POOL_EXTRA to be split into multiple extra fields X-Git-Tag: v2.6-dev1~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7fa092b727f45b2cb0975c36e9c1c61732f47db7;p=thirdparty%2Fhaproxy.git MINOR: pools: prepare POOL_EXTRA to be split into multiple extra fields Here the idea is to calculate the POOL_EXTRA size that is appended at the end of a pool object based on the sum of enabled optional fields so that we can more easily compute offsets and sizes depending on build options. For this, POOL_EXTRA is replaced with POOL_EXTRA_MARK which itself is set either to sizeof(void*) or zero depending on whether we enable marking the origin pool or not upon allocation. --- diff --git a/include/haproxy/pool.h b/include/haproxy/pool.h index 36105f19f5..e7b077a996 100644 --- a/include/haproxy/pool.h +++ b/include/haproxy/pool.h @@ -54,7 +54,7 @@ */ #ifdef DEBUG_MEMORY_POOLS -# define POOL_EXTRA (sizeof(void *)) +# define POOL_EXTRA_MARK (sizeof(void *)) # define POOL_DEBUG_SET_MARK(pool, item) \ do { \ typeof(pool) __p = (pool); \ @@ -72,12 +72,14 @@ #else // DEBUG_MEMORY_POOLS -# define POOL_EXTRA (0) +# define POOL_EXTRA_MARK (0) # define POOL_DEBUG_SET_MARK(pool, item) do { } while (0) # define POOL_DEBUG_CHECK_MARK(pool, item) do { } while (0) #endif // DEBUG_MEMORY_POOLS +# define POOL_EXTRA (POOL_EXTRA_MARK) + /* poison each newly allocated area with this byte if >= 0 */ extern int mem_poison_byte;