From 154874afda4a8df885e51c01f7681f04fb0b8e61 Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Sat, 9 Apr 2022 09:43:53 +0200 Subject: neue Verzeichnisstruktur --- allocator.h | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 allocator.h (limited to 'allocator.h') diff --git a/allocator.h b/allocator.h deleted file mode 100644 index dd9bb16..0000000 --- a/allocator.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include /* size_t */ - -struct allocator { - void *(*allocate)(struct allocator *allocator, size_t n); - void (*deallocate)(struct allocator *allocator, void *ptr); -}; - -extern struct allocator default_allocator; - -/* allocator interface */ -void *allocator_malloc(struct allocator *allocator, size_t n); -void allocator_free(struct allocator *allocator, void *ptr); - -/* helper functions */ -char *allocator_strdup(struct allocator *allocator, const char *str); -void *allocator_malloc_zero(struct allocator *allocator, size_t n); - -#define ALLOCATE(n) \ - allocator_malloc(&allocator_default_allocator, (n)) - -#define ALLOCATE_ZERO(n) \ - allocator_malloc_zero(&allocator_default_allocator, (n)) - -#define FREE(ptr) \ - (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