allocator implementation snippet

This commit is contained in:
2025-10-04 00:41:57 +02:00
parent 275969b4b2
commit 64893aa07e
+16
View File
@@ -5,3 +5,19 @@ snippet testfile
Test($1, $2) {
$0
}
snippet allocator
#include "allocator.h"
static void *${1}_alloc(void *this, size_t bytes, const char *file, int line) {
}
static void *${1}_resize(void *this, void *old_ptr, size_t bytes, const char *file, int line) {
}
static void ${1}_free(void *this, void *ptr, const char *file, int line) {
}
static const allocator_vtbl_t ${1}_vtbl = {
.alloc = ${1}_alloc,
.resize = ${1}_resize,
.free = ${1}_free,
};