2026-05-26 20:20:15 -06:00
|
|
|
#ifndef LAE_ALLOCATOR_H
|
|
|
|
|
#define LAE_ALLOCATOR_H
|
2026-05-25 15:15:52 -06:00
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
|
|
typedef struct Allocator Allocator;
|
|
|
|
|
|
|
|
|
|
Allocator allocator_default(void);
|
|
|
|
|
|
|
|
|
|
struct Allocator {
|
2026-06-08 17:53:33 -06:00
|
|
|
void *ctx;
|
2026-05-25 15:15:52 -06:00
|
|
|
|
2026-06-08 17:53:33 -06:00
|
|
|
void *(*alloc)(void *ctx, size_t size, size_t alignment);
|
2026-05-25 15:15:52 -06:00
|
|
|
|
2026-06-08 17:53:33 -06:00
|
|
|
void *(*realloc)(
|
|
|
|
|
void *ctx,
|
|
|
|
|
void *ptr,
|
|
|
|
|
size_t old_size,
|
|
|
|
|
size_t new_size,
|
|
|
|
|
size_t alignment);
|
2026-05-25 15:15:52 -06:00
|
|
|
|
2026-06-08 17:53:33 -06:00
|
|
|
void (*free)(void *ctx, void *ptr, size_t size, size_t alignment);
|
2026-05-25 15:15:52 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|