blob: d079b5c331e86d7efb360c4c2255f8286cba7758 [file] [log] [blame]
#ifndef __STATIC_ALLOCATOR_H_INCLUDED__
#define __STATIC_ALLOCATOR_H_INCLUDED__
#include <stdint.h>
typedef struct static_pool_header_s {
uint8_t num_items;
uint8_t item_size;
uint8_t first_free_item_index;
uint8_t free_items;
} static_pool_header_t;
typedef struct static_pool_s {
static_pool_header_t pool_header;
uint8_t pool[]; // num_items array of entries of size item_size
} static_pool_t;
void poolInit( static_pool_t* inPool,
uint8_t inItemSize,
uint8_t inNumItems );
void *poolAllocateBuffer( static_pool_t* inPool );
void poolFreeBuffer( static_pool_t* inPool, void* inPointer);
#endif // __STATIC_ALLOCATOR_H_INCLUDED__