Go to the source code of this file.
|
| struct | SELF |
| | An allocator that prints to stdout when it allocates or frees memory. More...
|
|
| static DC_PUBLIC SELF | new (ref alloc_ref) |
| | DC_MOCKABLE (void *, allocate_uninit,(SELF *self, size_t size)) |
| | DC_MOCKABLE (void *, allocate_zeroed,(SELF *self, size_t size)) |
| | DC_MOCKABLE (void *, reallocate,(SELF *self, void *ptr, size_t old_size, size_t new_size)) |
| | DC_MOCKABLE (void, deallocate,(SELF *self, void *ptr, size_t size)) |
| static DC_PUBLIC void | debug (SELF const *self, dc_debug_fmt fmt, FILE *stream) |
| static DC_PUBLIC void | delete (SELF *self) |
| | DC_TRAIT_REFERENCABLE_BY_PTR (SELF) |
| | DC_TRAIT_ALLOC (SELF) |
◆ DEBUG_MOCK_TOGGLE
| #define DEBUG_MOCK_TOGGLE |
( |
| name | ) |
|
Value:
static DC_PUBLIC void dc_debug_fmt_print(dc_debug_fmt fmt, FILE *stream, const char *format,...)
#define DC_MOCKABLE_ENABLED(name)
#define DC_EXPAND_STRING(NAME)
static DC_PUBLIC FILE * stream(SELF *self)
◆ DC_MOCKABLE() [1/4]
Definition at line 27 of file template.h.
27 {
29}
static DC_PUBLIC void * allocate_uninit(SELF *self, size_t size)
static DC_PUBLIC size_t size(SELF const *self)
◆ DC_MOCKABLE() [2/4]
Definition at line 31 of file template.h.
31 {
33}
static DC_PUBLIC void * allocate_zeroed(SELF *self, size_t size)
◆ DC_MOCKABLE() [3/4]
| DC_MOCKABLE |
( |
void * | , |
|
|
reallocate | , |
|
|
(SELF *self, void *ptr, size_t old_size, size_t new_size) | ) |
Definition at line 35 of file template.h.
36 {
38}
static DC_PUBLIC void * reallocate(SELF *self, void *ptr, size_t old_size, size_t new_size)
◆ DC_MOCKABLE() [4/4]
Definition at line 40 of file template.h.
40 {
42}
static DC_PUBLIC void deallocate(SELF *self, void *ptr, size_t size)
◆ DC_TRAIT_ALLOC()
◆ DC_TRAIT_REFERENCABLE_BY_PTR()
| DC_TRAIT_REFERENCABLE_BY_PTR |
( |
SELF | | ) |
|
◆ debug()
Definition at line 44 of file template.h.
44 {
50
53
54#define DEBUG_MOCK_TOGGLE(name) \
55 dc_debug_fmt_print(fmt, stream, DC_EXPAND_STRING(NS(SELF, name)) ": %s,\n", \
56 DC_MOCKABLE_ENABLED(NS(SELF, name)) ? "enabled" : "disabled")
57
62
63#undef DEBUG_MOCK_TOGGLE
64
67
70}
static DC_PUBLIC void debug(SELF const *self, dc_debug_fmt fmt, FILE *stream)
#define DEBUG_MOCK_TOGGLE(name)
static DC_PUBLIC dc_debug_fmt dc_debug_fmt_scope_end(dc_debug_fmt fmt)
static DC_PUBLIC dc_debug_fmt dc_debug_fmt_scope_begin(dc_debug_fmt fmt)
◆ delete()
Definition at line 72 of file template.h.
#define DC_ASSUME(expr,...)
◆ new()
Definition at line 23 of file template.h.
23 {
24 return (
SELF){.alloc_ref = alloc_ref};
25}