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.
This commit is contained in:
Willy Tarreau 2022-01-24 15:44:26 +01:00
parent d392973dcc
commit 7fa092b727

View 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); \
@ -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;