KEEL 1.0.0
Minimal C11 HTTP client/server library built on epoll/kqueue/io_uring/poll
Loading...
Searching...
No Matches
allocator.h
Go to the documentation of this file.
1#ifndef KEEL_ALLOCATOR_H
2#define KEEL_ALLOCATOR_H
3
4#include <stddef.h>
5
12typedef struct {
13 void *(*malloc)(void *ctx, size_t size);
14 void *(*realloc)(void *ctx, void *ptr, size_t old_size, size_t new_size);
15 void (*free)(void *ctx, void *ptr, size_t size);
16 void *ctx;
18
24
31void *kl_malloc(KlAllocator *a, size_t size);
32
41void *kl_realloc(KlAllocator *a, void *ptr, size_t old_size, size_t new_size);
42
49void kl_free(KlAllocator *a, void *ptr, size_t size);
50
51#endif
void * kl_realloc(KlAllocator *a, void *ptr, size_t old_size, size_t new_size)
Reallocate memory through the given allocator.
void kl_free(KlAllocator *a, void *ptr, size_t size)
Free memory through the given allocator.
void * kl_malloc(KlAllocator *a, size_t size)
Allocate memory through the given allocator.
KlAllocator kl_allocator_default(void)
Return the default stdlib-backed allocator.
Bring-your-own allocator vtable.
Definition allocator.h:12
void * ctx
Definition allocator.h:16