Commit 6a12bd7a authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by Cesanta Bot

Wrap LOG and DBG in do { ... } while(0)

PUBLISHED_FROM=c4f3d44ed16dba60db3198b90478c1b2e6f2a5c1
parent b39e30fb
...@@ -208,19 +208,23 @@ extern enum cs_log_level cs_log_level; ...@@ -208,19 +208,23 @@ extern enum cs_log_level cs_log_level;
void cs_log_print_prefix(const char *func); void cs_log_print_prefix(const char *func);
void cs_log_printf(const char *fmt, ...); void cs_log_printf(const char *fmt, ...);
#define LOG(l, x) \ #define LOG(l, x) \
if (cs_log_level >= l) { \ do { \
cs_log_print_prefix(__func__); \ if (cs_log_level >= l) { \
cs_log_printf x; \ cs_log_print_prefix(__func__); \
} cs_log_printf x; \
} \
} while (0)
#ifndef CS_NDEBUG #ifndef CS_NDEBUG
#define DBG(x) \ #define DBG(x) \
if (cs_log_level >= LL_VERBOSE_DEBUG) { \ do { \
cs_log_print_prefix(__func__); \ if (cs_log_level >= LL_VERBOSE_DEBUG) { \
cs_log_printf x; \ cs_log_print_prefix(__func__); \
} cs_log_printf x; \
} \
} while (0)
#else /* NDEBUG */ #else /* NDEBUG */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment