From 62b5acfcd5296a8f648716e7a51f00563be1668a Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Sun, 16 Jan 2022 11:29:41 +0100 Subject: feat: rename allocator interface --- allocator.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'allocator.h') diff --git a/allocator.h b/allocator.h index d47af52..dd9bb16 100644 --- a/allocator.h +++ b/allocator.h @@ -2,29 +2,29 @@ #include /* size_t */ -struct its1_allocator { - void *(*allocate)(struct its1_allocator *allocator, size_t n); - void (*deallocate)(struct its1_allocator *allocator, void *ptr); +struct allocator { + void *(*allocate)(struct allocator *allocator, size_t n); + void (*deallocate)(struct allocator *allocator, void *ptr); }; -extern struct its1_allocator its1_default_allocator; +extern struct allocator default_allocator; /* allocator interface */ -void *its1_malloc(struct its1_allocator *allocator, size_t n); -void its1_free(struct its1_allocator *allocator, void *ptr); +void *allocator_malloc(struct allocator *allocator, size_t n); +void allocator_free(struct allocator *allocator, void *ptr); /* helper functions */ -char *its1_strdup(struct its1_allocator *allocator, const char *str); -void *its1_malloc_zero(struct its1_allocator *allocator, size_t n); +char *allocator_strdup(struct allocator *allocator, const char *str); +void *allocator_malloc_zero(struct allocator *allocator, size_t n); #define ALLOCATE(n) \ - its1_malloc(&its1_default_allocator, (n)) + allocator_malloc(&allocator_default_allocator, (n)) #define ALLOCATE_ZERO(n) \ - its1_malloc_zero(&its1_default_allocator, (n)) + allocator_malloc_zero(&allocator_default_allocator, (n)) #define FREE(ptr) \ - (its1_free(&its1_default_allocator, (ptr)), (ptr) = NULL) + (allocator_free(&allocator_default_allocator, (ptr)), (ptr) = NULL) #define NEW(ptr) ((ptr) = ALLOCATE(sizeof *(ptr))) #define NEW0(ptr) ((ptr) = ALLOCATE_ZERO(sizeof *(ptr))) -- cgit v1.3