20 lines
616 B
C
20 lines
616 B
C
#ifndef FS_ALLOCATOR_H_
|
|
#define FS_ALLOCATOR_H_
|
|
|
|
#include <stddef.h>
|
|
|
|
struct fs_allocator {
|
|
void *fs_arg;
|
|
void *(*fs_alloc)(struct fs_allocator *, size_t);
|
|
void *(*fs_calloc)(struct fs_allocator *, size_t, size_t);
|
|
void *(*fs_realloc)(struct fs_allocator *, void *, size_t);
|
|
void (*fs_free)(struct fs_allocator *, void *);
|
|
};
|
|
|
|
extern void *fs_alloc(struct fs_allocator *alloc, size_t count);
|
|
extern void *fs_calloc(struct fs_allocator *alloc, size_t count, size_t sz);
|
|
extern void *fs_realloc(struct fs_allocator *alloc, void *p, size_t count);
|
|
extern void fs_free(struct fs_allocator *alloc, void *p);
|
|
|
|
#endif
|