mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-29 00:32:51 +00:00
Fixed some warnings, changed some debug defines to include better names
This commit is contained in:
parent
ae2d5266c5
commit
c779a9f29f
@ -326,7 +326,8 @@ lwip_getaddrinfo(const char *nodename, const char *servname,
|
|||||||
if (nodename != NULL) {
|
if (nodename != NULL) {
|
||||||
/* copy nodename to canonname if specified */
|
/* copy nodename to canonname if specified */
|
||||||
size_t namelen = strlen(nodename);
|
size_t namelen = strlen(nodename);
|
||||||
ai->ai_canonname = mem_malloc(namelen + 1);
|
LWIP_ASSERT("namelen is too long", (namelen + 1) <= (mem_size_t)-1);
|
||||||
|
ai->ai_canonname = mem_malloc((mem_size_t)(namelen + 1));
|
||||||
if (ai->ai_canonname == NULL) {
|
if (ai->ai_canonname == NULL) {
|
||||||
goto memerr;
|
goto memerr;
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ struct sswt_cb
|
|||||||
void
|
void
|
||||||
sys_mbox_fetch(sys_mbox_t mbox, void **msg)
|
sys_mbox_fetch(sys_mbox_t mbox, void **msg)
|
||||||
{
|
{
|
||||||
u32_t time;
|
u32_t time_needed;
|
||||||
struct sys_timeouts *timeouts;
|
struct sys_timeouts *timeouts;
|
||||||
struct sys_timeo *tmptimeout;
|
struct sys_timeo *tmptimeout;
|
||||||
sys_timeout_handler h;
|
sys_timeout_handler h;
|
||||||
@ -76,18 +76,18 @@ sys_mbox_fetch(sys_mbox_t mbox, void **msg)
|
|||||||
|
|
||||||
if (!timeouts || !timeouts->next) {
|
if (!timeouts || !timeouts->next) {
|
||||||
UNLOCK_TCPIP_CORE();
|
UNLOCK_TCPIP_CORE();
|
||||||
time = sys_arch_mbox_fetch(mbox, msg, 0);
|
time_needed = sys_arch_mbox_fetch(mbox, msg, 0);
|
||||||
LOCK_TCPIP_CORE();
|
LOCK_TCPIP_CORE();
|
||||||
} else {
|
} else {
|
||||||
if (timeouts->next->time > 0) {
|
if (timeouts->next->time > 0) {
|
||||||
UNLOCK_TCPIP_CORE();
|
UNLOCK_TCPIP_CORE();
|
||||||
time = sys_arch_mbox_fetch(mbox, msg, timeouts->next->time);
|
time_needed = sys_arch_mbox_fetch(mbox, msg, timeouts->next->time);
|
||||||
LOCK_TCPIP_CORE();
|
LOCK_TCPIP_CORE();
|
||||||
} else {
|
} else {
|
||||||
time = SYS_ARCH_TIMEOUT;
|
time_needed = SYS_ARCH_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time == SYS_ARCH_TIMEOUT) {
|
if (time_needed == SYS_ARCH_TIMEOUT) {
|
||||||
/* If time == SYS_ARCH_TIMEOUT, a timeout occured before a message
|
/* If time == SYS_ARCH_TIMEOUT, a timeout occured before a message
|
||||||
could be fetched. We should now call the timeout handler and
|
could be fetched. We should now call the timeout handler and
|
||||||
deallocate the memory allocated for the timeout. */
|
deallocate the memory allocated for the timeout. */
|
||||||
@ -107,8 +107,8 @@ sys_mbox_fetch(sys_mbox_t mbox, void **msg)
|
|||||||
/* If time != SYS_ARCH_TIMEOUT, a message was received before the timeout
|
/* If time != SYS_ARCH_TIMEOUT, a message was received before the timeout
|
||||||
occured. The time variable is set to the number of
|
occured. The time variable is set to the number of
|
||||||
milliseconds we waited for the message. */
|
milliseconds we waited for the message. */
|
||||||
if (time < timeouts->next->time) {
|
if (time_needed < timeouts->next->time) {
|
||||||
timeouts->next->time -= time;
|
timeouts->next->time -= time_needed;
|
||||||
} else {
|
} else {
|
||||||
timeouts->next->time = 0;
|
timeouts->next->time = 0;
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ sys_mbox_fetch(sys_mbox_t mbox, void **msg)
|
|||||||
void
|
void
|
||||||
sys_sem_wait(sys_sem_t sem)
|
sys_sem_wait(sys_sem_t sem)
|
||||||
{
|
{
|
||||||
u32_t time;
|
u32_t time_needed;
|
||||||
struct sys_timeouts *timeouts;
|
struct sys_timeouts *timeouts;
|
||||||
struct sys_timeo *tmptimeout;
|
struct sys_timeo *tmptimeout;
|
||||||
sys_timeout_handler h;
|
sys_timeout_handler h;
|
||||||
@ -139,12 +139,12 @@ sys_sem_wait(sys_sem_t sem)
|
|||||||
sys_arch_sem_wait(sem, 0);
|
sys_arch_sem_wait(sem, 0);
|
||||||
} else {
|
} else {
|
||||||
if (timeouts->next->time > 0) {
|
if (timeouts->next->time > 0) {
|
||||||
time = sys_arch_sem_wait(sem, timeouts->next->time);
|
time_needed = sys_arch_sem_wait(sem, timeouts->next->time);
|
||||||
} else {
|
} else {
|
||||||
time = SYS_ARCH_TIMEOUT;
|
time_needed = SYS_ARCH_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time == SYS_ARCH_TIMEOUT) {
|
if (time_needed == SYS_ARCH_TIMEOUT) {
|
||||||
/* If time == SYS_ARCH_TIMEOUT, a timeout occured before a message
|
/* If time == SYS_ARCH_TIMEOUT, a timeout occured before a message
|
||||||
could be fetched. We should now call the timeout handler and
|
could be fetched. We should now call the timeout handler and
|
||||||
deallocate the memory allocated for the timeout. */
|
deallocate the memory allocated for the timeout. */
|
||||||
@ -164,8 +164,8 @@ sys_sem_wait(sys_sem_t sem)
|
|||||||
/* If time != SYS_ARCH_TIMEOUT, a message was received before the timeout
|
/* If time != SYS_ARCH_TIMEOUT, a message was received before the timeout
|
||||||
occured. The time variable is set to the number of
|
occured. The time variable is set to the number of
|
||||||
milliseconds we waited for the message. */
|
milliseconds we waited for the message. */
|
||||||
if (time < timeouts->next->time) {
|
if (time_needed < timeouts->next->time) {
|
||||||
timeouts->next->time -= time;
|
timeouts->next->time -= time_needed;
|
||||||
} else {
|
} else {
|
||||||
timeouts->next->time = 0;
|
timeouts->next->time = 0;
|
||||||
}
|
}
|
||||||
|
@ -61,26 +61,28 @@
|
|||||||
#define LWIP_DBG_HALT 0x08U
|
#define LWIP_DBG_HALT 0x08U
|
||||||
|
|
||||||
#ifndef LWIP_NOASSERT
|
#ifndef LWIP_NOASSERT
|
||||||
#define LWIP_ASSERT(x,y) do { if(!(y)) LWIP_PLATFORM_ASSERT(x); } while(0)
|
#define LWIP_ASSERT(message, assertion) do { if(!(assertion)) \
|
||||||
|
LWIP_PLATFORM_ASSERT(message); } while(0)
|
||||||
#else /* LWIP_NOASSERT */
|
#else /* LWIP_NOASSERT */
|
||||||
#define LWIP_ASSERT(x,y)
|
#define LWIP_ASSERT(message, assertion)
|
||||||
#endif /* LWIP_NOASSERT */
|
#endif /* LWIP_NOASSERT */
|
||||||
|
|
||||||
/** if "e" isn't true, then print "m" message and execute "h" expression */
|
/** if "expression" isn't true, then print "message" and execute "handler" expression */
|
||||||
#ifndef LWIP_ERROR
|
#ifndef LWIP_ERROR
|
||||||
#define LWIP_ERROR(m,e,h) do { if (!(e)) { LWIP_PLATFORM_ASSERT(m); h;}} while(0)
|
#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \
|
||||||
|
LWIP_PLATFORM_ASSERT(message); handler;}} while(0)
|
||||||
#endif /* LWIP_ERROR */
|
#endif /* LWIP_ERROR */
|
||||||
|
|
||||||
#ifdef LWIP_DEBUG
|
#ifdef LWIP_DEBUG
|
||||||
/** print debug message only if debug message type is enabled...
|
/** print debug message only if debug message type is enabled...
|
||||||
* AND is of correct type AND is at least LWIP_DBG_LEVEL
|
* AND is of correct type AND is at least LWIP_DBG_LEVEL
|
||||||
*/
|
*/
|
||||||
#define LWIP_DEBUGF(debug,x) do { \
|
#define LWIP_DEBUGF(debug, message) do { \
|
||||||
if ( \
|
if ( \
|
||||||
((debug) & LWIP_DBG_ON) && \
|
((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)) { \
|
||||||
LWIP_PLATFORM_DIAG(x); \
|
LWIP_PLATFORM_DIAG(message); \
|
||||||
if ((debug) & LWIP_DBG_HALT) { \
|
if ((debug) & LWIP_DBG_HALT) { \
|
||||||
while(1); \
|
while(1); \
|
||||||
} \
|
} \
|
||||||
@ -88,7 +90,7 @@
|
|||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#else /* LWIP_DEBUG */
|
#else /* LWIP_DEBUG */
|
||||||
#define LWIP_DEBUGF(debug,x)
|
#define LWIP_DEBUGF(debug, message)
|
||||||
#endif /* LWIP_DEBUG */
|
#endif /* LWIP_DEBUG */
|
||||||
|
|
||||||
#endif /* __LWIP_DEBUG_H__ */
|
#endif /* __LWIP_DEBUG_H__ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user