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. However, this is usable inside unit tests written in C.
Definition at line 48 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 97 of file template.h.
97 {
100 if (ptr) {
102 .ptr = ptr,
103 .freed = false,
104 });
105 }
106 return ptr;
107}
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....
static INDEX_TYPE size(SELF const *self)
static ITEM * push(SELF *self, ITEM item)
#define DC_ASSUME(expr,...)
◆ DC_TRAIT_ALLOC()
◆ debug()
Definition at line 145 of file template.h.
145 {
152}
static void debug(SELF const *self, dc_debug_fmt fmt, FILE *stream)
dc_debug_fmt dc_debug_fmt_scope_end(dc_debug_fmt fmt)
dc_debug_fmt dc_debug_fmt_scope_begin(dc_debug_fmt fmt)
static void dc_debug_fmt_print(dc_debug_fmt fmt, FILE *stream, const char *format,...)
static FILE * stream(SELF *self)
Opens a file for.
◆ free()
| void free |
( |
SELF * | self, |
|
|
void * | ptr ) |
|
static |
Definition at line 127 of file template.h.
127 {
130
133
135 if (entry->
ptr == ptr) {
138 break;
139 }
140 }
141
143}
static void free(SELF *self, void *ptr)
static ITER get_iter(SELF *self)
◆ get_entries()
Definition at line 79 of file template.h.
79 {
81 return &self->entries;
82}
◆ malloc()
| void * malloc |
( |
SELF * | self, |
|
|
size_t | size ) |
|
static |
Definition at line 109 of file template.h.
109 {
112 if (ptr) {
114 .ptr = ptr,
115 .freed = false,
116 });
117 }
118 return ptr;
119}
static void * malloc(SELF *self, size_t size)
◆ new()
◆ realloc()
| void * realloc |
( |
SELF * | self, |
|
|
void * | ptr, |
|
|
size_t | size ) |
|
static |
Definition at line 121 of file template.h.
121 {
125}
static void * realloc(SELF *self, void *ptr, size_t size)
◆ unleak_and_delete()
| void unleak_and_delete |
( |
SELF * | self | ) |
|
|
static |