Replaced glib memory allocation
This commit is contained in:
parent
6101b8c43a
commit
d5729efa1f
33 changed files with 414 additions and 166 deletions
|
|
@ -19,9 +19,15 @@
|
|||
#define HAMMER_ALLOCATOR__H__
|
||||
#include <sys/types.h>
|
||||
|
||||
typedef struct HAllocator_ {
|
||||
void* (*alloc)(struct HAllocator_* allocator, size_t size);
|
||||
void* (*realloc)(struct HAllocator_* allocator, void* ptr, size_t size);
|
||||
void (*free)(struct HAllocator_* allocator, void* ptr);
|
||||
} HAllocator;
|
||||
|
||||
typedef struct HArena_ HArena ; // hidden implementation
|
||||
|
||||
HArena *h_new_arena(size_t block_size); // pass 0 for default...
|
||||
HArena *h_new_arena(HAllocator* allocator, size_t block_size); // pass 0 for default...
|
||||
void* h_arena_malloc(HArena *arena, size_t count) __attribute__(( malloc, alloc_size(2) ));
|
||||
void h_arena_free(HArena *arena, void* ptr); // For future expansion, with alternate memory managers.
|
||||
void h_delete_arena(HArena *arena);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue