libmicrohttpd2

HTTP server C library (MHD 2.x, alpha)
Log | Files | Refs | README | LICENSE

commit 12e09d4cdb2b35e58113bd20aef738be42a60563
parent 91915af50bb56b9d496d4026323ba2d10905b827
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date:   Sun,  2 Nov 2025 19:24:12 +0100

Added new internal function mhd_pool_get_size()

Diffstat:
Msrc/mhd2/mempool_funcs.c | 7+++++++
Msrc/mhd2/mempool_funcs.h | 8++++++++
2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/mhd2/mempool_funcs.c b/src/mhd2/mempool_funcs.c @@ -411,6 +411,13 @@ mhd_pool_destroy (struct mhd_MemoryPool *restrict pool) } +MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PURE_ size_t +mhd_pool_get_size (const struct mhd_MemoryPool *restrict pool) +{ + return (pool->size - mhd_RED_ZONE_SIZE); +} + + MHD_INTERNAL size_t mhd_pool_get_free (struct mhd_MemoryPool *restrict pool) { diff --git a/src/mhd2/mempool_funcs.h b/src/mhd2/mempool_funcs.h @@ -183,6 +183,14 @@ mhd_pool_reallocate (struct mhd_MemoryPool *restrict pool, size_t new_size) mhd_FN_RET_SIZED (4) mhd_FN_RET_ALIGNED (mhd_MEMPOOL_ALIGN_SIZE); +/** + * Get the size of the memory pool + * @param pool pool to check + * @return the maximum allocation size possible with empty memory pool + */ +MHD_INTERNAL size_t +mhd_pool_get_size (const struct mhd_MemoryPool *restrict pool) +MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PURE_; /** * Check how much memory is left in the @a pool