lpool: use offset to next, avoids pointer alignment requirments
This commit is contained in:
+3
-3
@@ -9,7 +9,7 @@ extern "C" {
|
||||
|
||||
typedef union LPoolBlock LPoolBlock;
|
||||
union LPoolBlock {
|
||||
LPoolBlock *next; // next free block (when not allocated)
|
||||
uint32_t next; // offset from start to next free block (when not allocated)
|
||||
unsigned char data[0]; // data when allocated
|
||||
};
|
||||
|
||||
@@ -30,8 +30,8 @@ union LPoolBlock {
|
||||
typedef struct LPool LPool;
|
||||
struct LPool {
|
||||
LPoolBlock *free_list; // free list
|
||||
LPoolBlock *start; // start of user buffer
|
||||
LPoolBlock *end; // one past end of user buffer
|
||||
uint8_t *start; // start of user buffer
|
||||
uint8_t *end; // one past end of user buffer
|
||||
uint32_t block_size; // aligned size of each block
|
||||
uint32_t capacity; // number of blocks
|
||||
uint32_t align; // alignment
|
||||
|
||||
Reference in New Issue
Block a user