Add macro for possible NULL prints and use it on known sports

The macro is effective on OpenBSD and basically a no op on other platforms.
Use it for one existing and the other known debug statements.
This commit is contained in:
the xhr
2023-01-09 17:58:01 +01:00
parent 6ceafac6aa
commit 714add207b
4 changed files with 11 additions and 5 deletions

View File

@@ -54,6 +54,12 @@ void auto_free_gcharv(gchar*** args);
void auto_free_char(char** str);
#define auto_char __attribute__((__cleanup__(auto_free_char)))
#if defined(__OpenBSD__)
#define STR_MAYBE_NULL(p) (p) ? : "(null)"
#else
#define STR_MAYBE_NULL(p) (p)
#endif
// assume malloc stores at most 8 bytes for size of allocated memory
// and page size is at least 4KB
#define READ_BUF_SIZE 4088