Go to the source code of this file.
◆ _DC_DEBUG_MAX_CAPACITY
| #define _DC_DEBUG_MAX_CAPACITY 4096 |
◆ DC_DEBUG
| #define DC_DEBUG |
( |
| DEBUG_FN, |
|
|
| DEBUG_PTR ) |
Value: ({ \
char const* result; \
} else { \
} \
result; \
})
static DC_INTERNAL char const * _dc_debug_dump_end(FILE *mem_stream)
static DC_INTERNAL FILE * _dc_debug_dump_start(void)
static const char * _dc_debug_trailing_space
A no-alloc, debug dump utility for use in asserts.
static DC_PUBLIC dc_debug_fmt dc_debug_fmt_new()
static DC_PUBLIC FILE * stream(SELF *self)
Definition at line 92 of file dump.h.
92#define DC_DEBUG(DEBUG_FN, DEBUG_PTR) \
93 ({ \
94 FILE* stream = _dc_debug_dump_start(); \
95 char const* result; \
96 if (stream == NULL) { \
97 result = _dc_debug_trailing_space; \
98 } else { \
99 DEBUG_FN(DEBUG_PTR, dc_debug_fmt_new(), stream); \
100 result = _dc_debug_dump_end(stream); \
101 } \
102 result; \
103 })
◆ _dc_debug_dump_end()
| DC_INTERNAL char const * _dc_debug_dump_end |
( |
FILE * | mem_stream | ) |
|
|
static |
Definition at line 39 of file dump.h.
39 {
40 if (mem_stream == NULL) {
42 }
43
44 fflush(mem_stream);
45 long used_long = ftell(mem_stream);
46 fclose(mem_stream);
47
48 if (used_long < 0) {
50 }
51
52 size_t used = (size_t)used_long;
53
57
58 if (used > available) {
59 size_t content_size = available - trailing_len;
60
61 for (size_t i = 0; i < trailing_len; i++) {
63 }
65
68 }
72}
#define _DC_DEBUG_MAX_CAPACITY
static DC_THREAD_LOCAL size_t _dc_debug_dump_head
static DC_THREAD_LOCAL char _dc_debug_dump_buf[_DC_DEBUG_MAX_CAPACITY+4]
static DC_THREAD_LOCAL size_t _dc_debug_dump_start_pos
◆ _dc_debug_dump_start()
Definition at line 20 of file dump.h.
20 {
21
22
23
24
25
26
28 return NULL;
29 }
30
33 size_t writable = available + 1;
34
36 return mem_stream;
37}
◆ dc_debug_dump_reset()
◆ _dc_debug_dump_buf
◆ _dc_debug_dump_head
◆ _dc_debug_dump_start_pos
◆ _dc_debug_trailing_space
| const char* _dc_debug_trailing_space = "..." |
|
static |
A no-alloc, debug dump utility for use in asserts.
- Writes debug formatted data to a static buffer, so stable & static-lifetime references can be used with string formatting.
- No heap allocation, so no leaking on format.
Definition at line 14 of file dump.h.