15#define QUOTE(name) #name
17#define STR(macro) QUOTE(macro)
20#define CAT(x, y) CAT_(x, y)
22#define CAT_(x, y) x##y
25#define buffer_size(format, ...) (snprintf(NULL, 0, (format), __VA_ARGS__) + 1)
34#define streq(x, y) (strcmp((x), (y)) == 0)
44#define strneq(x, y, n) (strncmp((x), (y), (n)) == 0)
54#define MAX(a, b) ((a) > (b) ? (a) : (b))
64#define MIN(a, b) ((a) < (b) ? (a) : (b))
74#define COALESCE(a, b) ((a == NULL) ? (b) : (a))
79#define errno_exit(of) \
91#define array_len(array) (sizeof(array) / sizeof((array)[0]))
94#define ATTR_FLAG_ENUM [[clang::flag_enum]]
100#define ATTR_FORMAT(archetype, string_index, first_to_check) __attribute__((format(archetype, string_index, first_to_check)))
102#define ATTR_FORMAT(archetype, string_index, first_to_check)
114char *
strfmt(
const char *fmt, ...) ATTR_FORMAT(printf, 1, 2);
135#if __STDC_VERSION__ < 202000L
136#define unreachable() abort()
char * fslurp(FILE *fp)
Slurps a stream into a dynamically allocated string.
char char * vstrfmt(const char *fmt, va_list ap)
Formats a string using a printf-style format string and a va_list of arguments.
char * strfmt(const char *fmt,...) ATTR_FORMAT(printf
Formats a string using a printf-style format string and arguments.