This commit is contained in:
Nils O. Selåsdal
2026-05-14 14:45:29 +02:00
parent d04b151279
commit 6185de0694
6 changed files with 15 additions and 16 deletions
+5 -3
View File
@@ -10,7 +10,7 @@ static inline LPoolBlock *lpool_next(LPool *pool, LPoolBlock *block)
if (block->next == NULL_BLOCK) {
return NULL;
}
return (LPoolBlock *)(pool->start + block->next);
return (LPoolBlock *)&pool->start[block->next];
}
static inline uint32_t lpool_offset(LPool *pool, LPoolBlock *block)
@@ -26,7 +26,7 @@ void lpool_init(LPool *pool, void *buffer, size_t buffer_size, uint32_t block_si
assert(align > 0);
assert((align & (align - 1)) == 0); // power of 2
// enforce minimum for storing free list pointers
// enforce minimum for storing free list offsets
if (align < _Alignof(LPoolBlock)) {
align = _Alignof(LPoolBlock);
@@ -111,7 +111,9 @@ void lpool_free(LPool *pool, void *ptr)
void lpool_reset(LPool *pool)
{
if (pool->capacity == 0) return;
if (pool->capacity == 0) {
return;
}
uintptr_t first_addr = (uintptr_t)pool->start;