mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-21 19:51:50 +00:00
Wrap LOG and DBG in do { ... } while(0)
PUBLISHED_FROM=c4f3d44ed16dba60db3198b90478c1b2e6f2a5c1
This commit is contained in:
1 parent
b39e30fb0c
commit
6a12bd7abc
1 file changed
+14
-10
+14
-10
@@ -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 */
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user