Fix -Wformat-truncation warnings (#493)

* Fix -Wformat-truncation warnings

* Don't evaluate macro parameters multiple times
This commit is contained in:
Khairul Azhar Kasmiran 2021-01-30 12:15:34 +08:00 committed by GitHub
parent 15f5040f71
commit 37d24d7f71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -194,7 +194,9 @@ void snprint_mem(char *out, size_t out_size, const ut8 *buf, size_t len) {
do { \
char _meqstr[MU_BUF_SIZE]; \
const char *act__ = (actual); \
act__ = act__ ? act__ : "(null)"; \
const char *exp__ = (expected); \
exp__ = exp__ ? exp__ : "(null)"; \
snprintf(_meqstr, MU_BUF_SIZE, "%s: expected %s, got %s.", (message), (exp__), (act__)); \
mu_assert(_meqstr, strcmp((exp__), (act__)) == 0); \
} while (0)