diff options
author | Jere Leppänen <jere.leppanen@nokia.com> | 2023-03-23 19:34:28 +0200 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2023-04-06 13:49:34 +0300 |
commit | b7d63c073373ac0049d4266a375a7c15e595f7ad (patch) | |
tree | c211804da2f34f91589967e1bea3fc1c3848f19d /helper | |
parent | 66c144e66f21a7e340045790b9a65b4982f9e3f4 (diff) |
helper: debug: reduce code duplication in ODPH_LOG
Call fprintf() in just one place in ODPH_LOG. As a nice side effect,
print format warnings also appear just once, instead of three times.
Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Diffstat (limited to 'helper')
-rw-r--r-- | helper/include/odp/helper/odph_debug.h | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/helper/include/odp/helper/odph_debug.h b/helper/include/odp/helper/odph_debug.h index 20ba3d04b..157f765d6 100644 --- a/helper/include/odp/helper/odph_debug.h +++ b/helper/include/odp/helper/odph_debug.h @@ -63,25 +63,11 @@ typedef enum odph_log_level { */ #define ODPH_LOG(level, fmt, ...) \ do { \ - switch (level) { \ - case ODPH_LOG_ERR: \ + if (level != ODPH_LOG_DBG || ODPH_DEBUG_PRINT == 1) \ fprintf(stderr, "%s:%d:%s():" fmt, __FILE__, \ __LINE__, __func__, ##__VA_ARGS__); \ - break; \ - case ODPH_LOG_DBG: \ - if (ODPH_DEBUG_PRINT == 1) \ - fprintf(stderr, "%s:%d:%s():" fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__); \ - break; \ - case ODPH_LOG_ABORT: \ - fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__); \ + if (level == ODPH_LOG_ABORT) \ abort(); \ - break; \ - default: \ - fprintf(stderr, "Unknown LOG level"); \ - break;\ - } \ } while (0) /** |