From 987d395b7b88b58cb412c88a57deb0e1eada1c37 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Thu, 13 Jul 2023 09:19:08 -0700 Subject: Add a free list to mempool. --- mempool/include/mempool.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mempool/include/mempool.h') 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 @@ // ----------------------------------------------------------------------------- typedef struct BlockInfo { - bool used; + size_t next; /// For free blocks, points to the next free block. + bool used; } BlockInfo; typedef struct mempool { size_t block_size_bytes; size_t num_blocks; - size_t next_free_block; - bool full; + size_t head; /// Points to the first block in the free list. bool dynamic; /// True if blocks and info are dynamically-allocated. BlockInfo* block_info; uint8_t* blocks; -- cgit v1.2.3