This commit is contained in:
Alvin-Zilverstand committed 2026-10-09 03:19:53 +02:00
1 parent 6dc841f956
commit 3d06f94e48
46 files changed
+5830 -543

No files matched your search

+5
View File
@@ -4,6 +4,8 @@
#include "types.h"
typedef int (*BOB64_HEAP_GROW)(void *context,void **region,usize *region_size);
/* Release a page-aligned tail region; return zero only after it is unmapped. */
typedef int (*BOB64_HEAP_SHRINK)(void *context,void *region,usize region_size);
typedef struct BOB64_HEAP_BLOCK BOB64_HEAP_BLOCK;
struct BOB64_HEAP_BLOCK {
@@ -17,13 +19,16 @@ struct BOB64_HEAP_BLOCK {
typedef struct {
BOB64_HEAP_BLOCK *First,*Last;
BOB64_HEAP_GROW Grow;
BOB64_HEAP_SHRINK Shrink;
void *Context;
void *Base;
usize MappedBytes,MaximumBytes;
u32 Lock;
} BOB64_HEAP;
int bob64_heap_init(BOB64_HEAP *heap,usize maximum_bytes,
BOB64_HEAP_GROW grow,void *context);
void bob64_heap_set_shrink(BOB64_HEAP *heap,BOB64_HEAP_SHRINK shrink);
void *bob64_heap_alloc(BOB64_HEAP *heap,usize size);
void *bob64_heap_calloc(BOB64_HEAP *heap,usize count,usize size);
int bob64_heap_free(BOB64_HEAP *heap,void *pointer);