]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: pools: prepare POOL_EXTRA to be split into multiple extra fields
authorWilly Tarreau <w@1wt.eu>
Mon, 24 Jan 2022 14:44:26 +0000 (15:44 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 24 Jan 2022 15:40:48 +0000 (16:40 +0100)
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.

include/haproxy/pool.h

index 36105f19f557155c41eb5007cfcbe6b6193d922f..e7b077a9964e7c752b2a9909ad7ff69506808781 100644 (file)
@@ -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);                              \
 
 #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;