diff options
Diffstat (limited to 'include/base/memory.h')
-rw-r--r-- | include/base/memory.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/base/memory.h b/include/base/memory.h index 6bf3cbc..a97615e 100644 --- a/include/base/memory.h +++ b/include/base/memory.h @@ -31,6 +31,7 @@ typedef struct mem·BufHead #define mem·buffree(b) ((b) ? (free(mem·bufhdr(b)), (b) = nil) : 0) #define mem·buffit(b, n) ((n) <= mem·bufcap(b) ? 0 : ((b) = mem·bufgrow((b), (n), sizeof(*(b))))) +#define mem·bufreset(b) ((b) ? (mem·bufhdr(b)->len=0) : 0) #define mem·bufpush(b, ...) (mem·buffit((b), 1 + mem·buflen(b)), (b)[mem·bufhdr(b)->len++] = (__VA_ARGS__)) #define mem·bufaddn(b, n) (mem·buffit(b, mem·buflen(b)+n), mem·bufhdr(b)->len += n, b+mem·bufhdr(b)->len-n) @@ -50,8 +51,8 @@ typedef struct mem·Pool mem·Pool; typedef struct mem·Arena mem·Arena; typedef struct mem·Allocator { - void *(*alloc)(void *heap, long n, uintptr size); - void *(*realloc)(void *heap, void *ptr, long n, uintptr size); + void *(*alloc)(void *heap, uintptr n, uintptr size); + void *(*realloc)(void *heap, void *ptr, uintptr n, uintptr size); void (*free)(void *heap, void *ptr); } mem·Allocator; |