mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
Make functions static where applicable, add default cases to switches where applicable, prevent old-style function prototypes (without arguments)
This commit is contained in:
parent
8bbe3d2fe0
commit
46b7bd6ec3
@ -653,7 +653,7 @@ netconn_free(struct netconn *conn)
|
||||
* @bytes_drained bytes drained from recvmbox
|
||||
* @accepts_drained pending connections drained from acceptmbox
|
||||
*/
|
||||
void
|
||||
static void
|
||||
netconn_drain(struct netconn *conn)
|
||||
{
|
||||
void *mem;
|
||||
@ -1343,6 +1343,9 @@ do_getaddr(struct api_msg_msg *msg)
|
||||
*(msg->msg.ad.port) = (msg->msg.ad.local?msg->conn->pcb.tcp->local_port:msg->conn->pcb.tcp->remote_port);
|
||||
break;
|
||||
#endif /* LWIP_TCP */
|
||||
default:
|
||||
LWIP_ASSERT("invalid netconn_type", 0);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
msg->err = ERR_CONN;
|
||||
|
@ -1643,6 +1643,9 @@ lwip_getsockopt_internal(void *arg)
|
||||
*(int*)optval = (udp_flags(sock->conn->pcb.udp) & UDP_FLAGS_NOCHKSUM) ? 1 : 0;
|
||||
break;
|
||||
#endif /* LWIP_UDP*/
|
||||
default:
|
||||
LWIP_ASSERT("unhandled optname", 0);
|
||||
break;
|
||||
} /* switch (optname) */
|
||||
break;
|
||||
|
||||
@ -1671,6 +1674,9 @@ lwip_getsockopt_internal(void *arg)
|
||||
s, *(u32_t *)optval));
|
||||
break;
|
||||
#endif /* LWIP_IGMP */
|
||||
default:
|
||||
LWIP_ASSERT("unhandled optname", 0);
|
||||
break;
|
||||
} /* switch (optname) */
|
||||
break;
|
||||
|
||||
@ -1706,7 +1712,9 @@ lwip_getsockopt_internal(void *arg)
|
||||
s, *(int *)optval));
|
||||
break;
|
||||
#endif /* LWIP_TCP_KEEPALIVE */
|
||||
|
||||
default:
|
||||
LWIP_ASSERT("unhandled optname", 0);
|
||||
break;
|
||||
} /* switch (optname) */
|
||||
break;
|
||||
#endif /* LWIP_TCP */
|
||||
@ -1724,9 +1732,15 @@ lwip_getsockopt_internal(void *arg)
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_UDPLITE, UDPLITE_RECV_CSCOV) = %d\n",
|
||||
s, (*(int*)optval)) );
|
||||
break;
|
||||
default:
|
||||
LWIP_ASSERT("unhandled optname", 0);
|
||||
break;
|
||||
} /* switch (optname) */
|
||||
break;
|
||||
#endif /* LWIP_UDP */
|
||||
default:
|
||||
LWIP_ASSERT("unhandled level", 0);
|
||||
break;
|
||||
} /* switch (level) */
|
||||
sys_sem_signal(&sock->conn->op_completed);
|
||||
}
|
||||
@ -1993,6 +2007,9 @@ lwip_setsockopt_internal(void *arg)
|
||||
}
|
||||
break;
|
||||
#endif /* LWIP_UDP */
|
||||
default:
|
||||
LWIP_ASSERT("unhandled optname", 0);
|
||||
break;
|
||||
} /* switch (optname) */
|
||||
break;
|
||||
|
||||
@ -2036,6 +2053,9 @@ lwip_setsockopt_internal(void *arg)
|
||||
}
|
||||
break;
|
||||
#endif /* LWIP_IGMP */
|
||||
default:
|
||||
LWIP_ASSERT("unhandled optname", 0);
|
||||
break;
|
||||
} /* switch (optname) */
|
||||
break;
|
||||
|
||||
@ -2075,7 +2095,9 @@ lwip_setsockopt_internal(void *arg)
|
||||
s, sock->conn->pcb.tcp->keep_cnt));
|
||||
break;
|
||||
#endif /* LWIP_TCP_KEEPALIVE */
|
||||
|
||||
default:
|
||||
LWIP_ASSERT("unhandled optname", 0);
|
||||
break;
|
||||
} /* switch (optname) */
|
||||
break;
|
||||
#endif /* LWIP_TCP*/
|
||||
@ -2103,9 +2125,15 @@ lwip_setsockopt_internal(void *arg)
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_UDPLITE, UDPLITE_RECV_CSCOV) -> %d\n",
|
||||
s, (*(int*)optval)) );
|
||||
break;
|
||||
default:
|
||||
LWIP_ASSERT("unhandled optname", 0);
|
||||
break;
|
||||
} /* switch (optname) */
|
||||
break;
|
||||
#endif /* LWIP_UDP */
|
||||
default:
|
||||
LWIP_ASSERT("unhandled level", 0);
|
||||
break;
|
||||
} /* switch (level) */
|
||||
sys_sem_signal(&sock->conn->op_completed);
|
||||
}
|
||||
@ -2193,6 +2221,9 @@ lwip_fcntl(int s, int cmd, int val)
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_fcntl(%d, UNIMPL: %d, %d)\n", s, cmd, val));
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -163,8 +163,9 @@ ipaddr_aton(const char *cp, ip_addr_t *addr)
|
||||
* a.b.c (with c treated as 16 bits)
|
||||
* a.b (with b treated as 24 bits)
|
||||
*/
|
||||
if (pp >= parts + 3)
|
||||
if (pp >= parts + 3) {
|
||||
return (0);
|
||||
}
|
||||
*pp++ = val;
|
||||
c = *++cp;
|
||||
} else
|
||||
@ -173,8 +174,9 @@ ipaddr_aton(const char *cp, ip_addr_t *addr)
|
||||
/*
|
||||
* Check for trailing characters.
|
||||
*/
|
||||
if (c != '\0' && !isspace(c))
|
||||
if (c != '\0' && !isspace(c)) {
|
||||
return (0);
|
||||
}
|
||||
/*
|
||||
* Concoct the address according to
|
||||
* the number of parts specified.
|
||||
@ -188,22 +190,28 @@ ipaddr_aton(const char *cp, ip_addr_t *addr)
|
||||
break;
|
||||
|
||||
case 2: /* a.b -- 8.24 bits */
|
||||
if (val > 0xffffffUL)
|
||||
if (val > 0xffffffUL) {
|
||||
return (0);
|
||||
}
|
||||
val |= parts[0] << 24;
|
||||
break;
|
||||
|
||||
case 3: /* a.b.c -- 8.8.16 bits */
|
||||
if (val > 0xffff)
|
||||
if (val > 0xffff) {
|
||||
return (0);
|
||||
}
|
||||
val |= (parts[0] << 24) | (parts[1] << 16);
|
||||
break;
|
||||
|
||||
case 4: /* a.b.c.d -- 8.8.8.8 bits */
|
||||
if (val > 0xff)
|
||||
if (val > 0xff) {
|
||||
return (0);
|
||||
}
|
||||
val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
|
||||
break;
|
||||
default:
|
||||
LWIP_ASSERT("unhandled", 0);
|
||||
break;
|
||||
}
|
||||
if (addr) {
|
||||
ip4_addr_set_u32(addr, htonl(val));
|
||||
|
@ -48,11 +48,11 @@
|
||||
|
||||
struct stats_ lwip_stats;
|
||||
|
||||
void stats_init()
|
||||
void stats_init(void)
|
||||
{
|
||||
#ifdef LWIP_DEBUG
|
||||
#if MEMP_STATS
|
||||
char * memp_names[] = {
|
||||
const char * memp_names[] = {
|
||||
#define LWIP_MEMPOOL(name,num,size,desc) desc,
|
||||
#include "lwip/memp_std.h"
|
||||
};
|
||||
|
@ -148,7 +148,7 @@ struct stats_ {
|
||||
|
||||
extern struct stats_ lwip_stats;
|
||||
|
||||
void stats_init();
|
||||
void stats_init(void);
|
||||
|
||||
#define STATS_INC(x) ++lwip_stats.x
|
||||
#define STATS_DEC(x) --lwip_stats.x
|
||||
@ -157,7 +157,7 @@ void stats_init();
|
||||
lwip_stats.x.max = lwip_stats.x.used; \
|
||||
} \
|
||||
} while(0)
|
||||
#else
|
||||
#else /* LWIP_STATS */
|
||||
#define stats_init()
|
||||
#define STATS_INC(x)
|
||||
#define STATS_DEC(x)
|
||||
@ -276,7 +276,7 @@ void stats_display_igmp(struct stats_igmp *igmp);
|
||||
void stats_display_mem(struct stats_mem *mem, char *name);
|
||||
void stats_display_memp(struct stats_mem *mem, int index);
|
||||
void stats_display_sys(struct stats_sys *sys);
|
||||
#else
|
||||
#else /* LWIP_STATS_DISPLAY */
|
||||
#define stats_display()
|
||||
#define stats_display_proto(proto, name)
|
||||
#define stats_display_igmp(igmp)
|
||||
|
Loading…
Reference in New Issue
Block a user