Files
cig/std_allocator.c
T
2025-10-11 03:31:23 +02:00

35 lines
752 B
C

#include "cig.h"
static void *stdlib_alloc(void *this, size_t bytes, const char *file, int line) {
(void)this;
(void)file;
(void)line;
return malloc(bytes);
}
static void *stdlib_resize(void *this, void *old_ptr, size_t bytes, const char *file, int line) {
(void)this;
(void)file;
(void)line;
return realloc(old_ptr, bytes);
}
static void stdlib_free(void *this, void *ptr, const char *file, int line) {
(void)this;
(void)file;
(void)line;
free(ptr);
}
static const allocator_vtbl_t stdlib_vtbl = {
.alloc = stdlib_alloc,
.resize = stdlib_resize,
.free = stdlib_free,
};
allocator_t allocator_stdlib() {
return (allocator_t) {
.this=NULL,
.vtbl=&stdlib_vtbl,
};
}