debug.h, api_msg.c: change LWIP_ERROR to use it to check errors like invalid pointers or parameters, and let the possibility to redefined it in cc.h. Use this macro to check "conn" parameter in api_msg.c functions (some others change will be done...).

This commit is contained in:
fbernon
2007-06-13 18:00:54 +00:00
parent bdbc96f453
commit 9ee85fb1b6
3 changed files with 32 additions and 23 deletions

View File

@@ -62,20 +62,23 @@
#define LWIP_DBG_HALT 0x08U
#ifndef LWIP_NOASSERT
# define LWIP_ASSERT(x,y) do { if(!(y)) LWIP_PLATFORM_ASSERT(x); } while(0)
#else
# define LWIP_ASSERT(x,y)
#endif
#define LWIP_ASSERT(x,y) do { if(!(y)) LWIP_PLATFORM_ASSERT(x); } while(0)
#else /* LWIP_NOASSERT */
#define LWIP_ASSERT(x,y)
#endif /* LWIP_NOASSERT */
/** print "m" message only if "e" is true, and execute "h" expression */
#ifndef LWIP_ERROR
#define LWIP_ERROR(m,e,h) do { if (e) { LWIP_PLATFORM_ASSERT(m); h;}} while(0)
#endif /* LWIP_ERROR */
#ifdef LWIP_DEBUG
/** print debug message only if debug message type is enabled...
* AND is of correct type AND is at least LWIP_DBG_LEVEL
*/
# define LWIP_DEBUGF(debug,x) do { if (((debug) & LWIP_DBG_ON) && ((debug) & LWIP_DBG_TYPES_ON) && ((s16_t)((debug) & LWIP_DBG_MASK_LEVEL) >= LWIP_DBG_MIN_LEVEL)) { LWIP_PLATFORM_DIAG(x); if ((debug) & LWIP_DBG_HALT) while(1); } } while(0)
# define LWIP_ERROR(x) do { LWIP_PLATFORM_DIAG(x); } while(0)
#else /* LWIP_DEBUG */
# define LWIP_DEBUGF(debug,x)
# define LWIP_ERROR(x)
#define LWIP_DEBUGF(debug,x) do { if (((debug) & LWIP_DBG_ON) && ((debug) & LWIP_DBG_TYPES_ON) && ((s16_t)((debug) & LWIP_DBG_MASK_LEVEL) >= LWIP_DBG_MIN_LEVEL)) { LWIP_PLATFORM_DIAG(x); if ((debug) & LWIP_DBG_HALT) while(1); } } while(0)
#else /* LWIP_DEBUG */
#define LWIP_DEBUGF(debug,x)
#endif /* LWIP_DEBUG */
#endif /* __LWIP_DEBUG_H__ */