#ifndef INCLUDE_WAYLANDCLIENT_ALLOCATOR_H_ #define INCLUDE_WAYLANDCLIENT_ALLOCATOR_H_ #include "sys/types.h" #define MAX_ALLOCS 256 struct Alloc { void *start; uint size; struct Alloc *next; }; struct Mem { void *mem; size_t mem_size; uint count; struct Alloc *alloc; struct Alloc allocs[MAX_ALLOCS]; }; struct Mem *make_mem(size_t size); void uninit_mem(struct Mem *mem); void *mem_malloc(struct Mem *mem, size_t size); void mem_free(struct Mem *mem, void *p); void *malloc_or_mem_malloc(struct Mem *mem, size_t size); void free_or_mem_free(struct Mem *mem, void *ptr); #endif // INCLUDE_WAYLANDCLIENT_ALLOCATOR_H_