rewrite some assertions for better readability

Some assertions are written as "if (x) assert(0)" to avoid having
the text of a long argument compiled in the binary. Rewrite them
to use a new BRIEF_ASSERT macro to make the condition easier to read in
its non-negated form and make it easier to turn it back to the full-text
assert if needed.
This commit is contained in:
Miroslav Lichvar
2025-03-05 12:28:46 +01:00
parent 454ce62672
commit 711c7c0c8a
16 changed files with 45 additions and 62 deletions

8
util.h
View File

@@ -272,4 +272,12 @@ extern int UTI_SplitString(char *string, char **words, int max_saved_words);
#define SQUARE(x) ((x) * (x))
/* Macro to make an assertion with the text of a long argument replaced
with "0" to avoid bloating the compiled binary */
#ifdef NDEBUG
#define BRIEF_ASSERT(a)
#else
#define BRIEF_ASSERT(a) if (!(a)) assert(0)
#endif
#endif /* GOT_UTIL_H */