Prefix functions with l in lalloc
This commit is contained in:
+10
-10
@@ -9,15 +9,15 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
// Internal header added in front of each allocation
|
||||
typedef struct BlockHeader BlockHeader;
|
||||
struct BlockHeader {
|
||||
typedef struct LBlockHeader LBlockHeader;
|
||||
struct LBlockHeader {
|
||||
uint32_t next; // offset from base
|
||||
uint32_t prev; // offset from base
|
||||
uint32_t size_and_flags; // size | free_bit
|
||||
// Padding to ensure we always return 16 byte aligned pointers.
|
||||
uint8_t pad[4];
|
||||
};
|
||||
_Static_assert(sizeof(BlockHeader) == 16, "sizeof(BlockHeader) is not 16");
|
||||
_Static_assert(sizeof(LBlockHeader) == 16, "sizeof(BlockHeader) is not 16");
|
||||
|
||||
/**
|
||||
* General purpose allocator.
|
||||
@@ -32,10 +32,10 @@ _Static_assert(sizeof(BlockHeader) == 16, "sizeof(BlockHeader) is not 16");
|
||||
*/
|
||||
typedef struct LAlloc LAlloc;
|
||||
struct LAlloc {
|
||||
uint8_t *base; // backing store
|
||||
uint32_t size; // total size
|
||||
BlockHeader *heap_start; // first block
|
||||
BlockHeader *next_alloc; // start of free block search
|
||||
uint8_t *base; // backing store
|
||||
uint32_t size; // total size
|
||||
LBlockHeader *heap_start; // first block
|
||||
LBlockHeader *next_alloc; // start of free block search
|
||||
};
|
||||
|
||||
void lalloc_init(LAlloc *allocator, void *backing_store, uint32_t size);
|
||||
@@ -43,9 +43,9 @@ void lalloc_init(LAlloc *allocator, void *backing_store, uint32_t size);
|
||||
void *lalloc(LAlloc *allocator, uint32_t size);
|
||||
void lfree(LAlloc *allocator, void *ptr);
|
||||
|
||||
BlockHeader *block_from_offset(const LAlloc *allocator, uint32_t offset);
|
||||
uint32_t block_size(const BlockHeader *block);
|
||||
int block_is_free(const BlockHeader *block);
|
||||
LBlockHeader *lblock_from_offset(const LAlloc *allocator, uint32_t offset);
|
||||
uint32_t lblock_size(const LBlockHeader *block);
|
||||
int lblock_is_free(const LBlockHeader *block);
|
||||
|
||||
#ifdef __ccplusplus
|
||||
} // extern "C"
|
||||
|
||||
Reference in New Issue
Block a user