diff options
author | 3gg <3gg@shellblade.net> | 2023-07-16 16:31:59 -0700 |
---|---|---|
committer | 3gg <3gg@shellblade.net> | 2023-07-16 16:31:59 -0700 |
commit | ecc2645ba4c44005ef13e33c79059de69b76551f (patch) | |
tree | 0a440aa55cf81d61688bbd34dfe8f07c39e55171 /mempool/include/mempool.h | |
parent | f48986597e6ff092feb0f18a79c6fa51a3f0e3bb (diff) |
Add function to query pool capacity.
Diffstat (limited to 'mempool/include/mempool.h')
-rw-r--r-- | mempool/include/mempool.h | 4 |
1 files changed, 4 insertions, 0 deletions
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 @@ | |||
80 | #define mempool_get_block_index(POOL, BLOCK_PTR) \ | 80 | #define mempool_get_block_index(POOL, BLOCK_PTR) \ |
81 | mempool_get_block_index_(&(POOL)->pool, BLOCK_PTR) | 81 | mempool_get_block_index_(&(POOL)->pool, BLOCK_PTR) |
82 | 82 | ||
83 | /// Return the total capacity of the mempool in bytes. | ||
84 | #define mempool_capacity(POOL) mempool_capacity_(&(POOL)->pool) | ||
85 | |||
83 | /// Iterate over the used blocks of the pool. | 86 | /// Iterate over the used blocks of the pool. |
84 | /// | 87 | /// |
85 | /// The caller can use 'i' as the index of the current block. | 88 | /// The caller can use 'i' as the index of the current block. |
@@ -133,3 +136,4 @@ void* mempool_alloc_(mempool*); | |||
133 | void mempool_free_(mempool*, void** block_ptr); | 136 | void mempool_free_(mempool*, void** block_ptr); |
134 | void* mempool_get_block_(const mempool*, size_t block_index); | 137 | void* mempool_get_block_(const mempool*, size_t block_index); |
135 | size_t mempool_get_block_index_(const mempool*, const void* block); | 138 | size_t mempool_get_block_index_(const mempool*, const void* block); |
139 | size_t mempool_capacity_(const mempool*); | ||