diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2026-05-01 20:35:00 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2026-05-01 22:16:26 +0300 |
| commit | 8946c27306abed7065afad3f015df5ee81e72ad2 (patch) | |
| tree | c53c9a2c0437109e9c1e3f873bf8a54220ee5ded /src/debug.c | |
| parent | 7790e27b3423901e2080bfd3c600a65a48d42886 (diff) | |
| download | fwd-8946c27306abed7065afad3f015df5ee81e72ad2.tar.gz fwd-8946c27306abed7065afad3f015df5ee81e72ad2.zip | |
add support for coverage
Diffstat (limited to 'src/debug.c')
| -rw-r--r-- | src/debug.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/debug.c b/src/debug.c index 2426277..d229ae6 100644 --- a/src/debug.c +++ b/src/debug.c @@ -14,6 +14,7 @@ #include <string.h> #include <stdarg.h> +#include <fwd/tracker.h> #include <fwd/debug.h> #include <fwd/scope.h> @@ -272,8 +273,15 @@ static void _type_str(FILE *f, struct type *type) char *type_str(struct type *t) { - if (!t) - return strdup("NULL"); + if (!t) { + char *s = strdupc("NULL"); + if (!s) { + internal_error("failed allocating null string"); + return NULL; + } + + return s; + } char *buf = NULL; size_t size = 0; FILE *memstream = open_memstream(&buf, &size); @@ -283,6 +291,8 @@ char *type_str(struct type *t) _type_str(memstream, t); fclose(memstream); + + track_ptr(buf); return buf; } |
