From e171b4e3f0cc62dd2187ec499fdeaa70606c3377 Mon Sep 17 00:00:00 2001 From: sg Date: Tue, 18 Aug 2015 20:29:16 +0200 Subject: [PATCH] Fixed usages of SYS_SEM_NULL after using pointers everywhere --- src/api/api_lib.c | 6 +++--- src/api/api_msg.c | 2 +- src/api/tcpip.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/api/api_lib.c b/src/api/api_lib.c index 21db1355..b36eefeb 100644 --- a/src/api/api_lib.c +++ b/src/api/api_lib.c @@ -870,17 +870,17 @@ netconn_gethostbyname(const char *name, ip_addr_t *addr) void netconn_thread_init(void) { sys_sem_t *sem = LWIP_NETCONN_THREAD_SEM_GET(); - if (sem == SYS_SEM_NULL) { + if (!sys_sem_valid(sem)) { /* call alloc only once */ LWIP_NETCONN_THREAD_SEM_ALLOC(); - LWIP_ASSERT("LWIP_NETCONN_THREAD_SEM_ALLOC() failed", LWIP_NETCONN_THREAD_SEM_GET() != SYS_SEM_NULL); + LWIP_ASSERT("LWIP_NETCONN_THREAD_SEM_ALLOC() failed", sys_sem_valid(LWIP_NETCONN_THREAD_SEM_GET())); } } void netconn_thread_cleanup(void) { sys_sem_t *sem = LWIP_NETCONN_THREAD_SEM_GET(); - if (sem != SYS_SEM_NULL) { + if (sys_sem_valid(sem)) { /* call free only once */ LWIP_NETCONN_THREAD_SEM_FREE(); } diff --git a/src/api/api_msg.c b/src/api/api_msg.c index 6569c043..71c8d510 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -415,7 +415,7 @@ err_tcp(void *arg, err_t err) LWIP_ASSERT("conn->current_msg != NULL", conn->current_msg != NULL); conn->current_msg->err = err; op_completed_sem = LWIP_API_MSG_SEM(conn->current_msg); - LWIP_ASSERT("inavlid op_completed_sem", op_completed_sem != SYS_SEM_NULL); + LWIP_ASSERT("inavlid op_completed_sem", sys_sem_valid(op_completed_sem)); conn->current_msg = NULL; /* wake up the waiting task */ NETCONN_SET_SAFE_ERR(conn, err); diff --git a/src/api/tcpip.c b/src/api/tcpip.c index 31d5bb46..34ec5013 100644 --- a/src/api/tcpip.c +++ b/src/api/tcpip.c @@ -382,7 +382,7 @@ tcpip_apimsg(struct api_msg *apimsg) #if LWIP_NETCONN_SEM_PER_THREAD apimsg->msg.op_completed_sem = LWIP_NETCONN_THREAD_SEM_GET(); LWIP_ASSERT("netconn semaphore not initialized", - apimsg->msg.op_completed_sem != SYS_SEM_NULL); + sys_sem_valid(apimsg->msg.op_completed_sem)); #endif sys_mbox_post(&mbox, &TCPIP_MSG_VAR_REF(msg)); sys_arch_sem_wait(LWIP_API_MSG_SEM(&apimsg->msg), 0);