minor: coding style fixes

This commit is contained in:
goldsimon
2016-07-05 07:36:51 +02:00
parent cb5f7859fd
commit 14ca418ac0
21 changed files with 155 additions and 160 deletions

View File

@@ -201,13 +201,13 @@ static void dhcp_option_trailer(struct dhcp *dhcp);
static err_t
dhcp_inc_pcb_refcount(void)
{
if(dhcp_pcb_refcount == 0) {
if (dhcp_pcb_refcount == 0) {
LWIP_ASSERT("dhcp_inc_pcb_refcount(): memory leak", dhcp_pcb == NULL);
/* allocate UDP PCB */
dhcp_pcb = udp_new();
if(dhcp_pcb == NULL) {
if (dhcp_pcb == NULL) {
return ERR_MEM;
}
@@ -231,7 +231,7 @@ dhcp_dec_pcb_refcount(void)
LWIP_ASSERT("dhcp_pcb_refcount(): refcount error", (dhcp_pcb_refcount > 0));
dhcp_pcb_refcount--;
if(dhcp_pcb_refcount == 0) {
if (dhcp_pcb_refcount == 0) {
udp_remove(dhcp_pcb);
dhcp_pcb = NULL;
}
@@ -731,7 +731,7 @@ dhcp_start(struct netif *netif)
LWIP_ASSERT("pbuf p_out wasn't freed", dhcp->p_out == NULL);
LWIP_ASSERT("reply wasn't freed", dhcp->msg_in == NULL );
if(dhcp->pcb_allocated != 0) {
if (dhcp->pcb_allocated != 0) {
dhcp_dec_pcb_refcount(); /* free DHCP PCB if not needed any more */
}
/* dhcp is cleared below, no need to reset flag*/
@@ -743,7 +743,7 @@ dhcp_start(struct netif *netif)
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_start(): starting DHCP configuration\n"));
if(dhcp_inc_pcb_refcount() != ERR_OK) { /* ensure DHCP PCB is allocated */
if (dhcp_inc_pcb_refcount() != ERR_OK) { /* ensure DHCP PCB is allocated */
return ERR_MEM;
}
dhcp->pcb_allocated = 1;
@@ -784,7 +784,7 @@ dhcp_inform(struct netif *netif)
LWIP_ERROR("netif != NULL", (netif != NULL), return;);
if(dhcp_inc_pcb_refcount() != ERR_OK) { /* ensure DHCP PCB is allocated */
if (dhcp_inc_pcb_refcount() != ERR_OK) { /* ensure DHCP PCB is allocated */
return;
}
@@ -1327,7 +1327,7 @@ dhcp_stop(struct netif *netif)
LWIP_ASSERT("reply wasn't freed", dhcp->msg_in == NULL);
dhcp_set_state(dhcp, DHCP_STATE_OFF);
if(dhcp->pcb_allocated != 0) {
if (dhcp->pcb_allocated != 0) {
dhcp_dec_pcb_refcount(); /* free DHCP PCB if not needed any more */
dhcp->pcb_allocated = 0;
}
@@ -1645,7 +1645,7 @@ dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *addr,
LWIP_UNUSED_ARG(arg);
/* Caught DHCP message from netif that does not have DHCP enabled? -> not interested */
if((dhcp == NULL) || (dhcp->pcb_allocated == 0)) {
if ((dhcp == NULL) || (dhcp->pcb_allocated == 0)) {
goto free_pbuf_and_return;
}
@@ -1739,7 +1739,7 @@ dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *addr,
}
free_pbuf_and_return:
if(dhcp != NULL) {
if (dhcp != NULL) {
dhcp->msg_in = NULL;
}
pbuf_free(p);

View File

@@ -445,7 +445,7 @@ ip6_input(struct pbuf *p, struct netif *inp)
ip_addr_copy_from_ip6(ip_data.current_iphdr_src, ip6hdr->src);
/* Don't accept virtual IPv6 mapped IPv4 addresses */
if(ip6_addr_isipv6mappedipv4(ip_2_ip6(&ip_data.current_iphdr_dest)) ||
if (ip6_addr_isipv6mappedipv4(ip_2_ip6(&ip_data.current_iphdr_dest)) ||
ip6_addr_isipv6mappedipv4(ip_2_ip6(&ip_data.current_iphdr_src)) ) {
IP6_STATS_INC(ip6.err);
IP6_STATS_INC(ip6.drop);

View File

@@ -1862,13 +1862,13 @@ nd6_cleanup_netif(struct netif * netif)
u8_t i;
s8_t router_index;
for (i = 0; i < LWIP_ND6_NUM_PREFIXES; i++) {
if(prefix_list[i].netif == netif) {
if (prefix_list[i].netif == netif) {
prefix_list[i].netif = NULL;
prefix_list[i].flags = 0;
}
}
for (i = 0; i < LWIP_ND6_NUM_NEIGHBORS; i++) {
if(neighbor_cache[i].netif == netif) {
if (neighbor_cache[i].netif == netif) {
for (router_index = 0; router_index < LWIP_ND6_NUM_ROUTERS; router_index++) {
if (default_router_list[router_index].neighbor_entry == &neighbor_cache[i]) {
default_router_list[router_index].neighbor_entry = NULL;

View File

@@ -324,7 +324,7 @@ memp_malloc_fn(memp_t type, const char* file, const int line)
if (memp != NULL) {
MEMP_STATS_INC(used, type);
if(MEMP_STATS_GET(used, type) > MEMP_STATS_GET(max, type)) {
if (MEMP_STATS_GET(used, type) > MEMP_STATS_GET(max, type)) {
MEMP_STATS_AVAIL(max, type, MEMP_STATS_GET(used, type));
}
} else {

View File

@@ -64,9 +64,9 @@ raw_input_match(struct raw_pcb *pcb, u8_t broadcast)
#if LWIP_IPV4 && LWIP_IPV6
/* Dual-stack: PCBs listening to any IP type also listen to any IP address */
if(IP_IS_ANY_TYPE_VAL(pcb->local_ip)) {
if (IP_IS_ANY_TYPE_VAL(pcb->local_ip)) {
#if IP_SOF_BROADCAST_RECV
if((broadcast != 0) && !ip_get_option(pcb, SOF_BROADCAST)) {
if ((broadcast != 0) && !ip_get_option(pcb, SOF_BROADCAST)) {
return 0;
}
#endif /* IP_SOF_BROADCAST_RECV */
@@ -75,23 +75,23 @@ raw_input_match(struct raw_pcb *pcb, u8_t broadcast)
#endif /* LWIP_IPV4 && LWIP_IPV6 */
/* Only need to check PCB if incoming IP version matches PCB IP version */
if(IP_ADDR_PCB_VERSION_MATCH_EXACT(pcb, ip_current_dest_addr())) {
if (IP_ADDR_PCB_VERSION_MATCH_EXACT(pcb, ip_current_dest_addr())) {
#if LWIP_IPV4
/* Special case: IPv4 broadcast: receive all broadcasts
* Note: broadcast variable can only be 1 if it is an IPv4 broadcast */
if(broadcast != 0) {
if (broadcast != 0) {
#if IP_SOF_BROADCAST_RECV
if(ip_get_option(pcb, SOF_BROADCAST))
if (ip_get_option(pcb, SOF_BROADCAST))
#endif /* IP_SOF_BROADCAST_RECV */
{
if(ip4_addr_isany(ip_2_ip4(&pcb->local_ip))) {
if (ip4_addr_isany(ip_2_ip4(&pcb->local_ip))) {
return 1;
}
}
} else
#endif /* LWIP_IPV4 */
/* Handle IPv4 and IPv6: catch all or exact match */
if(ip_addr_isany(&pcb->local_ip) ||
if (ip_addr_isany(&pcb->local_ip) ||
ip_addr_cmp(&pcb->local_ip, ip_current_dest_addr())) {
return 1;
}
@@ -468,7 +468,7 @@ raw_new_ip_type(u8_t type, u8_t proto)
struct raw_pcb *pcb;
pcb = raw_new(proto);
#if LWIP_IPV4 && LWIP_IPV6
if(pcb != NULL) {
if (pcb != NULL) {
IP_SET_TYPE_VAL(pcb->local_ip, type);
IP_SET_TYPE_VAL(pcb->remote_ip, type);
}

View File

@@ -1591,7 +1591,7 @@ tcp_new_ip_type(u8_t type)
struct tcp_pcb * pcb;
pcb = tcp_alloc(TCP_PRIO_NORMAL);
#if LWIP_IPV4 && LWIP_IPV6
if(pcb != NULL) {
if (pcb != NULL) {
IP_SET_TYPE_VAL(pcb->local_ip, type);
IP_SET_TYPE_VAL(pcb->remote_ip, type);
}

View File

@@ -1055,7 +1055,7 @@ tcp_output(struct tcp_pcb *pcb)
* either seg->next != NULL or pcb->unacked == NULL;
* RST is no sent using tcp_write/tcp_output.
*/
if((tcp_do_output_nagle(pcb) == 0) &&
if ((tcp_do_output_nagle(pcb) == 0) &&
((pcb->flags & (TF_NAGLEMEMERR | TF_FIN)) == 0)) {
break;
}

View File

@@ -153,9 +153,9 @@ udp_input_local_match(struct udp_pcb *pcb, struct netif *inp, u8_t broadcast)
LWIP_UNUSED_ARG(broadcast); /* in IPv6 only case */
/* Dual-stack: PCBs listening to any IP type also listen to any IP address */
if(IP_IS_ANY_TYPE_VAL(pcb->local_ip)) {
if (IP_IS_ANY_TYPE_VAL(pcb->local_ip)) {
#if LWIP_IPV4 && IP_SOF_BROADCAST_RECV
if((broadcast != 0) && !ip_get_option(pcb, SOF_BROADCAST)) {
if ((broadcast != 0) && !ip_get_option(pcb, SOF_BROADCAST)) {
return 0;
}
#endif /* LWIP_IPV4 && IP_SOF_BROADCAST_RECV */
@@ -163,16 +163,16 @@ udp_input_local_match(struct udp_pcb *pcb, struct netif *inp, u8_t broadcast)
}
/* Only need to check PCB if incoming IP version matches PCB IP version */
if(IP_ADDR_PCB_VERSION_MATCH_EXACT(pcb, ip_current_dest_addr())) {
if (IP_ADDR_PCB_VERSION_MATCH_EXACT(pcb, ip_current_dest_addr())) {
#if LWIP_IPV4
/* Special case: IPv4 broadcast: all or broadcasts in my subnet
* Note: broadcast variable can only be 1 if it is an IPv4 broadcast */
if(broadcast != 0) {
if (broadcast != 0) {
#if IP_SOF_BROADCAST_RECV
if(ip_get_option(pcb, SOF_BROADCAST))
if (ip_get_option(pcb, SOF_BROADCAST))
#endif /* IP_SOF_BROADCAST_RECV */
{
if(ip4_addr_isany(ip_2_ip4(&pcb->local_ip)) ||
if (ip4_addr_isany(ip_2_ip4(&pcb->local_ip)) ||
((ip4_current_dest_addr()->addr == IPADDR_BROADCAST)) ||
ip4_addr_netcmp(ip_2_ip4(&pcb->local_ip), ip4_current_dest_addr(), netif_ip4_netmask(inp))) {
return 1;
@@ -181,7 +181,7 @@ udp_input_local_match(struct udp_pcb *pcb, struct netif *inp, u8_t broadcast)
} else
#endif /* LWIP_IPV4 */
/* Handle IPv4 and IPv6: all, multicast or exact match */
if(ip_addr_isany(&pcb->local_ip) ||
if (ip_addr_isany(&pcb->local_ip) ||
#if LWIP_IPV6_MLD
(ip_current_is_v6() && ip6_addr_ismulticast(ip6_current_dest_addr())) ||
#endif /* LWIP_IPV6_MLD */
@@ -1039,7 +1039,7 @@ udp_disconnect(struct udp_pcb *pcb)
{
/* reset remote address association */
#if LWIP_IPV4 && LWIP_IPV6
if(IP_IS_ANY_TYPE_VAL(pcb->local_ip)) {
if (IP_IS_ANY_TYPE_VAL(pcb->local_ip)) {
ip_addr_copy(pcb->remote_ip, *IP_ANY_TYPE);
} else {
#endif
@@ -1144,7 +1144,7 @@ udp_new_ip_type(u8_t type)
struct udp_pcb *pcb;
pcb = udp_new();
#if LWIP_IPV4 && LWIP_IPV6
if(pcb != NULL) {
if (pcb != NULL) {
IP_SET_TYPE_VAL(pcb->local_ip, type);
IP_SET_TYPE_VAL(pcb->remote_ip, type);
}