From ecc2645ba4c44005ef13e33c79059de69b76551f Mon Sep 17 00:00:00 2001
From: 3gg <3gg@shellblade.net>
Date: Sun, 16 Jul 2023 16:31:59 -0700
Subject: Add function to query pool capacity.

---
 mempool/include/mempool.h | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'mempool/include/mempool.h')

diff --git a/mempool/include/mempool.h b/mempool/include/mempool.h
index b76ae7c..8251a70 100644
--- a/mempool/include/mempool.h
+++ b/mempool/include/mempool.h
@@ -80,6 +80,9 @@
 #define mempool_get_block_index(POOL, BLOCK_PTR) \
   mempool_get_block_index_(&(POOL)->pool, BLOCK_PTR)
 
+/// Return the total capacity of the mempool in bytes.
+#define mempool_capacity(POOL) mempool_capacity_(&(POOL)->pool)
+
 /// Iterate over the used blocks of the pool.
 ///
 /// The caller can use 'i' as the index of the current block.
@@ -133,3 +136,4 @@ void*  mempool_alloc_(mempool*);
 void   mempool_free_(mempool*, void** block_ptr);
 void*  mempool_get_block_(const mempool*, size_t block_index);
 size_t mempool_get_block_index_(const mempool*, const void* block);
+size_t mempool_capacity_(const mempool*);
-- 
cgit v1.2.3