17#ifndef __clang_analyzer__
18#error "The allocator being wrapped must be defined"
21#define ALLOC nullalloc
25#ifndef __clang_analyzer__
26#error "The name of the type to generate for storing entries must be defined"
28#define ENTRIES derive_c_entries_placeholder_name
55#define TRACKED_ENTRY NAME(ENTRIES, entry)
62#pragma push_macro("SELF")
68#define T TRACKED_ENTRY
73#pragma pop_macro("SELF")
81 return (
SELF){.alloc = alloc, .entries =
NAME(
ENTRIES,
new)(stdalloc_get())};
86 return &self->entries;
139 while ((entry =
NAME(
ENTRIES, iter_next)(&iter))) {
140 if (entry->
ptr == ptr) {
#define ALLOC
An allocator that prints to stdout when it allocates or frees memory.
static void free(SELF *self, void *ptr)
static void * realloc(SELF *self, void *ptr, size_t size)
static void * malloc(SELF *self, size_t size)
static void * calloc(SELF *self, size_t count, size_t size)
static void unleak_and_delete(SELF *self)
static ENTRIES const * get_entries(SELF const *self)
#define DEBUG_ASSERT(expr)
static ITER get_iter(SELF *self)
static INDEX_TYPE size(SELF const *self)
static T * push(SELF *self, T value)
#define ALLOC
A simple vector.