Go to the source code of this file.
◆ ALLOC
◆ ENTRIES_VECTOR
#define ENTRIES_VECTOR NS(NAME, entries) |
For unit tests expected to throw, as C has no unwind, we cannot free allocated memory. This macro wraps the allocator in debug, to allow clearing leaks after an exception.
In release, it is a no-op / pass through.
As this is entirely C, we do not get the niceties of a C++ RAII allocator guard shebang.
Definition at line 40 of file template.h.
◆ INTERNAL_NAME
◆ ITEM
◆ TRACKED_ENTRY
#define TRACKED_ENTRY NS(EXPAND(ENTRIES), entry) |
◆ calloc()
void * calloc |
( |
SELF * | self, |
|
|
size_t | count, |
|
|
size_t | size ) |
|
static |
Definition at line 89 of file template.h.
89 {
92 if (ptr) {
94 .ptr = ptr,
95 .freed = false,
96 });
97 }
98 return ptr;
99}
static void * calloc(SELF *self, size_t count, size_t size)
#define ENTRIES_VECTOR
For unit tests expected to throw, as C has no unwind, we cannot free allocated memory....
#define DEBUG_ASSERT(expr)
static INDEX_TYPE size(SELF const *self)
static ITEM * push(SELF *self, ITEM item)
◆ free()
void free |
( |
SELF * | self, |
|
|
void * | ptr ) |
|
static |
Definition at line 119 of file template.h.
119 {
122
125
127 if (entry->
ptr == ptr) {
130 break;
131 }
132 }
133
135}
static void free(SELF *self, void *ptr)
static ITER get_iter(SELF *self)
◆ get_entries()
Definition at line 71 of file template.h.
71 {
73 return &self->entries;
74}
◆ malloc()
void * malloc |
( |
SELF * | self, |
|
|
size_t | size ) |
|
static |
Definition at line 101 of file template.h.
101 {
104 if (ptr) {
106 .ptr = ptr,
107 .freed = false,
108 });
109 }
110 return ptr;
111}
static void * malloc(SELF *self, size_t size)
◆ new()
◆ realloc()
void * realloc |
( |
SELF * | self, |
|
|
void * | ptr, |
|
|
size_t | size ) |
|
static |
Definition at line 113 of file template.h.
113 {
117}
static void * realloc(SELF *self, void *ptr, size_t size)
◆ unleak_and_delete()
void unleak_and_delete |
( |
SELF * | self | ) |
|
|
static |