mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-07 15:04:39 +08:00
debug: split debug enable checks from LWIP_DEBUGF to LWIP_DEBUG_ENABLED
In order to reuse the debug-enable checks for PPP debug macros, move the flag and level checks from LWIP_DEBUGF to a new macro that can be used elsewhere.
This commit is contained in:
parent
b43f081b9a
commit
827b60c155
@ -140,11 +140,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LWIP_DEBUG
|
#ifdef LWIP_DEBUG
|
||||||
#define LWIP_DEBUGF(debug, message) do { \
|
#define LWIP_DEBUG_ENABLED(debug) (((debug) & LWIP_DBG_ON) && \
|
||||||
if ( \
|
|
||||||
((debug) & LWIP_DBG_ON) && \
|
|
||||||
((debug) & LWIP_DBG_TYPES_ON) && \
|
((debug) & LWIP_DBG_TYPES_ON) && \
|
||||||
((s16_t)((debug) & LWIP_DBG_MASK_LEVEL) >= LWIP_DBG_MIN_LEVEL)) { \
|
((s16_t)((debug) & LWIP_DBG_MASK_LEVEL) >= LWIP_DBG_MIN_LEVEL))
|
||||||
|
|
||||||
|
#define LWIP_DEBUGF(debug, message) do { \
|
||||||
|
if (LWIP_DEBUG_ENABLED(debug)) { \
|
||||||
LWIP_PLATFORM_DIAG(message); \
|
LWIP_PLATFORM_DIAG(message); \
|
||||||
if ((debug) & LWIP_DBG_HALT) { \
|
if ((debug) & LWIP_DBG_HALT) { \
|
||||||
while(1); \
|
while(1); \
|
||||||
@ -153,6 +154,7 @@
|
|||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#else /* LWIP_DEBUG */
|
#else /* LWIP_DEBUG */
|
||||||
|
#define LWIP_DEBUG_ENABLED(debug) 0
|
||||||
#define LWIP_DEBUGF(debug, message)
|
#define LWIP_DEBUGF(debug, message)
|
||||||
#endif /* LWIP_DEBUG */
|
#endif /* LWIP_DEBUG */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user