This file contains global type definitions which are used throughout the entire engine and applicatio...
#define KAPI
Import/export qualifier.
Definition: defines.h:177
_Bool b8
8-bit boolean type
Definition: defines.h:58
unsigned long long u64
Unsigned 64-bit integer.
Definition: defines.h:28
KAPI b8 freelist_resize(freelist *list, u64 *memory_requirement, void *new_memory, u64 new_size, void **out_old_memory)
Attempts to resize the provided freelist to the given size. Internal data is copied to the new block ...
KAPI void freelist_destroy(freelist *list)
Destroys the provided list.
KAPI b8 freelist_free_block(freelist *list, u64 size, u64 offset)
Attempts to free a block of memory at the given offset, and of the given size. Can fail if invalid da...
KAPI void freelist_clear(freelist *list)
Clears the free list.
KAPI void freelist_create(u64 total_size, u64 *memory_requirement, void *memory, freelist *out_list)
Creates a new freelist or obtains the memory requirement for one. Call twice; once passing 0 to memor...
struct freelist freelist
A data structure to be used alongside an allocator for dynamic memory allocation. Tracks free ranges ...
KAPI b8 freelist_allocate_block(freelist *list, u64 size, u64 *out_offset)
Attempts to find a free block of memory of the given size.
KAPI u64 freelist_free_space(freelist *list)
Returns the amount of free space in this list. NOTE: Since this has to iterate the entire internal li...
A data structure to be used alongside an allocator for dynamic memory allocation. Tracks free ranges ...
Definition: freelist.h:20
void * memory
The internal state of the freelist.
Definition: freelist.h:22