mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-17 10:49:47 +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_printf(const char *fmt, ...);
|
||||
|
||||
#define LOG(l, x) \
|
||||
if (cs_log_level >= l) { \
|
||||
cs_log_print_prefix(__func__); \
|
||||
cs_log_printf x; \
|
||||
}
|
||||
#define LOG(l, x) \
|
||||
do { \
|
||||
if (cs_log_level >= l) { \
|
||||
cs_log_print_prefix(__func__); \
|
||||
cs_log_printf x; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#ifndef CS_NDEBUG
|
||||
|
||||
#define DBG(x) \
|
||||
if (cs_log_level >= LL_VERBOSE_DEBUG) { \
|
||||
cs_log_print_prefix(__func__); \
|
||||
cs_log_printf x; \
|
||||
}
|
||||
#define DBG(x) \
|
||||
do { \
|
||||
if (cs_log_level >= LL_VERBOSE_DEBUG) { \
|
||||
cs_log_print_prefix(__func__); \
|
||||
cs_log_printf x; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#else /* NDEBUG */
|
||||
|
||||
|
||||
Reference in new issue
Block a user