feat(lwip): Format code

This commit is contained in:
Dong Heng
2018-06-25 17:20:58 +08:00
parent 305a338a27
commit cccd058783

View File

@ -6,16 +6,16 @@
#include "../../lwip/src/api/sockets.c" #include "../../lwip/src/api/sockets.c"
#ifndef LWIP_SYNC_MT_SLEEP_MS #ifndef LWIP_SYNC_MT_SLEEP_MS
#define LWIP_SYNC_MT_SLEEP_MS 10 #define LWIP_SYNC_MT_SLEEP_MS 10
#endif #endif
#ifndef SOCK_MT_DEBUG_LEVEL #ifndef SOCK_MT_DEBUG_LEVEL
#define SOCK_MT_DEBUG_LEVEL 255 #define SOCK_MT_DEBUG_LEVEL 255
#endif #endif
typedef int (*lwip_io_mt_fn)(int , int ); typedef int (*lwip_io_mt_fn)(int, int );
enum sock_mt_stat{ enum sock_mt_stat {
SOCK_MT_STATE_NONE = 0, SOCK_MT_STATE_NONE = 0,
SOCK_MT_STATE_BIND, SOCK_MT_STATE_BIND,
SOCK_MT_STATE_LISTEN, SOCK_MT_STATE_LISTEN,
@ -63,11 +63,11 @@ struct _sock_mt {
typedef struct _sock_mt sock_mt_t; typedef struct _sock_mt sock_mt_t;
#if (SOCK_MT_DEBUG_LEVEL < 16) #if (SOCK_MT_DEBUG_LEVEL < 16)
#define SOCK_MT_DEBUG(level, ...) \ #define SOCK_MT_DEBUG(level, ...) \
if (level >= SOCK_MT_DEBUG_LEVEL) \ if (level >= SOCK_MT_DEBUG_LEVEL) \
printf(__VA_ARGS__); printf(__VA_ARGS__);
#else #else
#define SOCK_MT_DEBUG(level, ...) #define SOCK_MT_DEBUG(level, ...)
#endif #endif
#if 0 #if 0
@ -252,7 +252,7 @@ static sock_mt_t sockets_mt[NUM_SOCKETS];
static int lwip_enter_mt_state(int s, int arg) static int lwip_enter_mt_state(int s, int arg)
{ {
if(tryget_socket(s) == NULL || if (tryget_socket(s) == NULL ||
SOCK_MT_GET_STATE(s) != SOCK_MT_STATE_NONE || SOCK_MT_GET_STATE(s) != SOCK_MT_STATE_NONE ||
SOCK_MT_GET_WRITE_SEL(s)) SOCK_MT_GET_WRITE_SEL(s))
return -1; return -1;
@ -265,7 +265,7 @@ static int lwip_enter_mt_state(int s, int arg)
static int lwip_enter_mt_recv(int s, int arg) static int lwip_enter_mt_recv(int s, int arg)
{ {
if(tryget_socket(s) == NULL || if (tryget_socket(s) == NULL ||
SOCK_MT_GET_READ_SEL(s)) SOCK_MT_GET_READ_SEL(s))
return -1; return -1;
@ -276,7 +276,7 @@ static int lwip_enter_mt_recv(int s, int arg)
static int lwip_enter_mt_shutdown(int s, int arg) static int lwip_enter_mt_shutdown(int s, int arg)
{ {
if(tryget_socket(s) == NULL if (tryget_socket(s) == NULL
|| SOCK_MT_GET_SHUTDOWN(s) != SOCK_MT_SHUTDOWN_NONE) || SOCK_MT_GET_SHUTDOWN(s) != SOCK_MT_SHUTDOWN_NONE)
return -1; return -1;
@ -287,7 +287,7 @@ static int lwip_enter_mt_shutdown(int s, int arg)
static int lwip_enter_mt_close(int s, int arg) static int lwip_enter_mt_close(int s, int arg)
{ {
if(tryget_socket(s) == NULL) if (tryget_socket(s) == NULL)
return -1; return -1;
SOCK_MT_SET_SHUTDOWN(s, SOCK_MT_SHUTDOWN_OK); SOCK_MT_SET_SHUTDOWN(s, SOCK_MT_SHUTDOWN_OK);
@ -344,7 +344,7 @@ failed2:
} }
failed1: failed1:
for (i--; i >=0; i--) { for (i--; i >=0; i--) {
if (FD_ISSET(i, read_set) ){ if (FD_ISSET(i, read_set) ) {
SOCK_MT_UNLOCK(i, SOCK_MT_RECV_LOCK); SOCK_MT_UNLOCK(i, SOCK_MT_RECV_LOCK);
SOCK_MT_RESET_READ_SEL(i); SOCK_MT_RESET_READ_SEL(i);
} }
@ -360,7 +360,7 @@ failed1:
static int lwip_enter_mt_ioctrl(int s, int arg) static int lwip_enter_mt_ioctrl(int s, int arg)
{ {
if(tryget_socket(s) == NULL) if (tryget_socket(s) == NULL)
return -1; return -1;
SOCK_MT_LOCK(s, SOCK_MT_IOCTRL_LOCK); SOCK_MT_LOCK(s, SOCK_MT_IOCTRL_LOCK);
@ -497,7 +497,7 @@ static void lwip_do_sync_rst_state(void *arg)
sys_sem_signal(&(conn->ioctrl_completed)); sys_sem_signal(&(conn->ioctrl_completed));
} }
static void lwip_sync_state_mt(struct lwip_sock *sock , int state) static void lwip_sync_state_mt(struct lwip_sock *sock, int state)
{ {
SOCK_MT_DEBUG(1, "sync state %d\n", state); SOCK_MT_DEBUG(1, "sync state %d\n", state);
@ -733,7 +733,7 @@ int lwip_getsockopt_mt(int s, int level, int optname, void *optval, socklen_t *o
{ {
int ret; int ret;
if (optname == SO_ERROR ) { if (optname == SO_ERROR) {
int retval = 0; int retval = 0;
if (SOCK_MT_GET_SHUTDOWN(s) != SOCK_MT_SHUTDOWN_NONE) if (SOCK_MT_GET_SHUTDOWN(s) != SOCK_MT_SHUTDOWN_NONE)