aboutsummaryrefslogtreecommitdiff
path: root/mempool/include
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2023-07-13 09:19:08 -0700
committer3gg <3gg@shellblade.net>2023-07-13 09:19:08 -0700
commit987d395b7b88b58cb412c88a57deb0e1eada1c37 (patch)
treea7394546c110266a0b480b3ec34057d82781f2c2 /mempool/include
parentde8bbfdfa0f9e95ec2f9847762f5c009765b92f4 (diff)
Add a free list to mempool.
Diffstat (limited to 'mempool/include')
-rw-r--r--mempool/include/mempool.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/mempool/include/mempool.h b/mempool/include/mempool.h
index 994e25a..b76ae7c 100644
--- a/mempool/include/mempool.h
+++ b/mempool/include/mempool.h
@@ -100,14 +100,14 @@
100// ----------------------------------------------------------------------------- 100// -----------------------------------------------------------------------------
101 101
102typedef struct BlockInfo { 102typedef struct BlockInfo {
103 bool used; 103 size_t next; /// For free blocks, points to the next free block.
104 bool used;
104} BlockInfo; 105} BlockInfo;
105 106
106typedef struct mempool { 107typedef struct mempool {
107 size_t block_size_bytes; 108 size_t block_size_bytes;
108 size_t num_blocks; 109 size_t num_blocks;
109 size_t next_free_block; 110 size_t head; /// Points to the first block in the free list.
110 bool full;
111 bool dynamic; /// True if blocks and info are dynamically-allocated. 111 bool dynamic; /// True if blocks and info are dynamically-allocated.
112 BlockInfo* block_info; 112 BlockInfo* block_info;
113 uint8_t* blocks; 113 uint8_t* blocks;