diff options
| author | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
|---|---|---|
| committer | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
| commit | 967be9e750221ab2ab783f95df79bb26d290a45e (patch) | |
| tree | 6802900a5e975f9f68b169f0f503f040056d6952 /malloc/block_allocator/allocator.h | |
Diffstat (limited to 'malloc/block_allocator/allocator.h')
| -rw-r--r-- | malloc/block_allocator/allocator.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/malloc/block_allocator/allocator.h b/malloc/block_allocator/allocator.h new file mode 100644 index 0000000..98dd63e --- /dev/null +++ b/malloc/block_allocator/allocator.h @@ -0,0 +1,25 @@ +#ifndef ALLOCATOR_H +#define ALLOCATOR_H + +#include <stddef.h> + +struct blk_meta +{ + struct blk_meta *next; + size_t size; + char data[]; +}; + +struct blk_allocator +{ + struct blk_meta *meta; +}; + +struct blk_allocator *blka_new(void); +void blka_delete(struct blk_allocator *blka); + +struct blk_meta *blka_alloc(struct blk_allocator *blka, size_t size); +void blka_free(struct blk_meta *blk); +void blka_pop(struct blk_allocator *blka); + +#endif /* !ALLOCATOR_H */ |
