diff --git a/src/api/api_msg.c b/src/api/api_msg.c index 130d6589..012f1c69 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -1396,7 +1396,7 @@ lwip_netconn_do_recv(struct api_msg_msg *msg) u16_t recved = (remaining > 0xffff) ? 0xffff : (u16_t)remaining; tcp_recved(msg->conn->pcb.tcp, recved); remaining -= recved; - }while(remaining != 0); + } while (remaining != 0); } } } diff --git a/src/api/sockets.c b/src/api/sockets.c index bebbe9f5..50cb75f0 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -847,10 +847,10 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags, if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_TCP) { LWIP_ASSERT("invalid copylen, len would underflow", len >= copylen); len -= copylen; - if ( (len <= 0) || - (p->flags & PBUF_FLAG_PUSH) || - (sock->rcvevent <= 0) || - ((flags & MSG_PEEK)!=0)) { + if ((len <= 0) || + (p->flags & PBUF_FLAG_PUSH) || + (sock->rcvevent <= 0) || + ((flags & MSG_PEEK) != 0)) { done = 1; } } else { @@ -1004,7 +1004,7 @@ lwip_sendmsg(int s, const struct msghdr *msg, int flags) ((flags & MSG_MORE) ? NETCONN_MORE : 0) | ((flags & MSG_DONTWAIT) ? NETCONN_DONTBLOCK : 0); - for(i = 0; i < msg->msg_iovlen; i++) { + for (i = 0; i < msg->msg_iovlen; i++) { written = 0; err = netconn_write_partly(sock->conn, msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len, write_flags, &written); if (err == ERR_OK) { @@ -1049,7 +1049,7 @@ lwip_sendmsg(int s, const struct msghdr *msg, int flags) netbuf_fromport(chain_buf) = remote_port; } #if LWIP_NETIF_TX_SINGLE_PBUF - for(i = 0; i < msg->msg_iovlen; i++) { + for (i = 0; i < msg->msg_iovlen; i++) { size += msg->msg_iov[i].iov_len; } /* Allocate a new netbuf and copy the data into it. */ @@ -1059,7 +1059,7 @@ lwip_sendmsg(int s, const struct msghdr *msg, int flags) else { /* flatten the IO vectors */ size_t offset = 0; - for(i = 0; i < msg->msg_iovlen; i++ ) { + for (i = 0; i < msg->msg_iovlen; i++) { MEMCPY(&((u8_t*)chain_buf->p->payload)[offset], msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len); offset += msg->msg_iov[i].iov_len; } @@ -1078,7 +1078,7 @@ lwip_sendmsg(int s, const struct msghdr *msg, int flags) if (err == ERR_OK) { struct netbuf *tail_buf; size = msg->msg_iov[0].iov_len; - for(i = 1; i < msg->msg_iovlen; i++) { + for (i = 1; i < msg->msg_iovlen; i++) { tail_buf = netbuf_new(); if (!tail_buf) { err = ERR_MEM; @@ -1318,7 +1318,7 @@ lwip_selscan(int maxfdp1, fd_set *readset_in, fd_set *writeset_in, fd_set *excep /* Go through each socket in each list to count number of sockets which currently match */ - for(i = LWIP_SOCKET_OFFSET; i < maxfdp1; i++) { + for (i = LWIP_SOCKET_OFFSET; i < maxfdp1; i++) { void* lastdata = NULL; s16_t rcvevent = 0; u16_t sendevent = 0; diff --git a/src/core/dhcp.c b/src/core/dhcp.c index 3369ec27..7861e7bf 100644 --- a/src/core/dhcp.c +++ b/src/core/dhcp.c @@ -584,7 +584,7 @@ dhcp_handle_ack(struct netif *netif) #if LWIP_DHCP_GET_NTP_SRV /* NTP servers */ - for(n = 0; (n < LWIP_DHCP_MAX_NTP_SERVERS) && dhcp_option_given(dhcp, DHCP_OPTION_IDX_NTP_SERVER + n); n++) { + for (n = 0; (n < LWIP_DHCP_MAX_NTP_SERVERS) && dhcp_option_given(dhcp, DHCP_OPTION_IDX_NTP_SERVER + n); n++) { ip4_addr_set_u32(&ntp_server_addrs[n], htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_NTP_SERVER + n))); } dhcp_set_ntp_servers(n, ntp_server_addrs); @@ -592,7 +592,7 @@ dhcp_handle_ack(struct netif *netif) #if LWIP_DNS /* DNS servers */ - for(n = 0; (n < DNS_MAX_SERVERS) && dhcp_option_given(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n); n++) { + for (n = 0; (n < DNS_MAX_SERVERS) && dhcp_option_given(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n); n++) { ip_addr_t dns_addr; ip_addr_set_ip4_u32(&dns_addr, htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n))); dns_setserver(n, &dns_addr); @@ -1404,7 +1404,7 @@ dhcp_parse_reply(struct dhcp *dhcp, struct pbuf *p) options_idx_max = p->tot_len; again: q = p; - while((q != NULL) && (options_idx >= q->len)) { + while ((q != NULL) && (options_idx >= q->len)) { options_idx -= q->len; options_idx_max -= q->len; q = q->next; @@ -1416,7 +1416,7 @@ again: offset_max = options_idx_max; options = (u8_t*)q->payload; /* at least 1 byte to read and no end marker, then at least 3 bytes to read? */ - while((q != NULL) && (options[offset] != DHCP_OPTION_END) && (offset < offset_max)) { + while ((q != NULL) && (options[offset] != DHCP_OPTION_END) && (offset < offset_max)) { u8_t op = options[offset]; u8_t len; u8_t decode_len = 0; diff --git a/src/core/dns.c b/src/core/dns.c index 9a650530..3c019a3e 100644 --- a/src/core/dns.c +++ b/src/core/dns.c @@ -494,7 +494,7 @@ dns_lookup_local(const char *hostname, ip_addr_t *addr LWIP_DNS_ADDRTYPE_ARG(u8_ { #if DNS_LOCAL_HOSTLIST_IS_DYNAMIC struct local_hostlist_entry *entry = local_hostlist_dynamic; - while(entry != NULL) { + while (entry != NULL) { if ((LWIP_DNS_STRICMP(entry->name, hostname) == 0) && LWIP_DNS_ADDRTYPE_MATCH_IP(dns_addrtype, entry->addr)) { if (addr) { @@ -756,14 +756,14 @@ dns_send(u8_t idx) do { ++hostname; hostname_part = hostname; - for(n = 0; *hostname != '.' && *hostname != 0; ++hostname) { + for (n = 0; *hostname != '.' && *hostname != 0; ++hostname) { ++n; } copy_len = (u16_t)(hostname - hostname_part); pbuf_put_at(p, query_idx, n); pbuf_take_at(p, hostname_part, copy_len, query_idx + 1); query_idx += n + 1; - } while(*hostname != 0); + } while (*hostname != 0); pbuf_put_at(p, query_idx, 0); query_idx++; @@ -815,7 +815,7 @@ dns_alloc_random_port(void) continue; } err = udp_bind(ret, IP_ADDR_ANY, port); - } while(err == ERR_USE); + } while (err == ERR_USE); if ((err != ERR_OK) && (err != ERR_USE)) { udp_remove(ret); return NULL; diff --git a/src/core/inet_chksum.c b/src/core/inet_chksum.c index d25a0d32..bcaa3dc8 100644 --- a/src/core/inet_chksum.c +++ b/src/core/inet_chksum.c @@ -266,7 +266,7 @@ inet_cksum_pseudo_base(struct pbuf *p, u8_t proto, u16_t proto_len, u32_t acc) u8_t swapped = 0; /* iterate through all pbuf in chain */ - for(q = p; q != NULL; q = q->next) { + for (q = p; q != NULL; q = q->next) { LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): checksumming pbuf %p (has next %p) \n", (void *)q, (void *)q->next)); acc += LWIP_CHKSUM(q->payload, q->len); @@ -407,7 +407,7 @@ inet_cksum_pseudo_partial_base(struct pbuf *p, u8_t proto, u16_t proto_len, u16_t chklen; /* iterate through all pbuf in chain */ - for(q = p; (q != NULL) && (chksum_len > 0); q = q->next) { + for (q = p; (q != NULL) && (chksum_len > 0); q = q->next) { LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): checksumming pbuf %p (has next %p) \n", (void *)q, (void *)q->next)); chklen = q->len; @@ -576,7 +576,7 @@ inet_chksum_pbuf(struct pbuf *p) acc = 0; swapped = 0; - for(q = p; q != NULL; q = q->next) { + for (q = p; q != NULL; q = q->next) { acc += LWIP_CHKSUM(q->payload, q->len); acc = FOLD_U32T(acc); if (q->len % 2 != 0) { diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c index 93631d3c..cbe003ee 100644 --- a/src/core/ipv4/ip4.c +++ b/src/core/ipv4/ip4.c @@ -538,7 +538,7 @@ ip4_input(struct pbuf *p, struct netif *inp) if (netif == inp) { netif = netif->next; } - } while(netif != NULL); + } while (netif != NULL); } #if IP_ACCEPT_LINK_LAYER_ADDRESSING diff --git a/src/core/ipv4/ip4_addr.c b/src/core/ipv4/ip4_addr.c index 829ebcb8..7fe35c98 100644 --- a/src/core/ipv4/ip4_addr.c +++ b/src/core/ipv4/ip4_addr.c @@ -305,14 +305,14 @@ ip4addr_ntoa_r(const ip4_addr_t *addr, char *buf, int buflen) rp = buf; ap = (u8_t *)&s_addr; - for(n = 0; n < 4; n++) { + for (n = 0; n < 4; n++) { i = 0; do { rem = *ap % (u8_t)10; *ap /= (u8_t)10; inv[i++] = '0' + rem; - } while(*ap); - while(i--) { + } while (*ap); + while (i--) { if (len++ >= buflen) { return NULL; } diff --git a/src/core/ipv4/ip_frag.c b/src/core/ipv4/ip_frag.c index b829bdaf..306f31b7 100644 --- a/src/core/ipv4/ip_frag.c +++ b/src/core/ipv4/ip_frag.c @@ -591,7 +591,7 @@ ip4_reass(struct pbuf *p) p = ipr->p; /* chain together the pbufs contained within the reass_data list. */ - while(r != NULL) { + while (r != NULL) { iprh = (struct ip_reass_helper*)r->payload; /* hide the ip header for every succeeding fragment */ diff --git a/src/core/ipv6/ip6.c b/src/core/ipv6/ip6.c index 38f0b390..1be9944e 100644 --- a/src/core/ipv6/ip6.c +++ b/src/core/ipv6/ip6.c @@ -112,7 +112,7 @@ ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest) } /* Try to find the netif for the source address, checking that link is up. */ - for(netif = netif_list; netif != NULL; netif = netif->next) { + for (netif = netif_list; netif != NULL; netif = netif->next) { if (!netif_is_up(netif) || !netif_is_link_up(netif)) { continue; } @@ -132,7 +132,7 @@ ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest) } /* See if the destination subnet matches a configured address. */ - for(netif = netif_list; netif != NULL; netif = netif->next) { + for (netif = netif_list; netif != NULL; netif = netif->next) { if (!netif_is_up(netif) || !netif_is_link_up(netif)) { continue; } @@ -158,7 +158,7 @@ ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest) /* try with the netif that matches the source address. */ if (!ip6_addr_isany(src)) { - for(netif = netif_list; netif != NULL; netif = netif->next) { + for (netif = netif_list; netif != NULL; netif = netif->next) { if (!netif_is_up(netif) || !netif_is_link_up(netif)) { continue; } @@ -529,7 +529,7 @@ ip6_input(struct pbuf *p, struct netif *inp) if (netif == inp) { netif = netif->next; } - } while(netif != NULL); + } while (netif != NULL); netif_found: LWIP_DEBUGF(IP6_DEBUG, ("ip6_input: packet accepted on interface %c%c\n", netif ? netif->name[0] : 'X', netif? netif->name[1] : 'X')); diff --git a/src/core/ipv6/ip6_frag.c b/src/core/ipv6/ip6_frag.c index 66bda07c..c9e13cd2 100644 --- a/src/core/ipv6/ip6_frag.c +++ b/src/core/ipv6/ip6_frag.c @@ -514,7 +514,7 @@ ip6_reass(struct pbuf *p) /* chain together the pbufs contained within the ip6_reassdata list. */ iprh = (struct ip6_reass_helper*) ipr->p->payload; - while(iprh != NULL) { + while (iprh != NULL) { struct pbuf* next_pbuf = iprh->next_pbuf; if (next_pbuf != NULL) { /* Save next helper struct (will be hidden in next step). */ diff --git a/src/core/ipv6/nd6.c b/src/core/ipv6/nd6.c index 85ca8ea4..e3f458d9 100644 --- a/src/core/ipv6/nd6.c +++ b/src/core/ipv6/nd6.c @@ -331,7 +331,7 @@ nd6_input(struct pbuf *p, struct netif *inp) } i = nd6_find_neighbor_cache_entry(ip6_current_src_addr()); - if ( i>= 0) { + if (i>= 0) { /* We already have a record for the solicitor. */ if (neighbor_cache[i].state == ND6_INCOMPLETE) { neighbor_cache[i].netif = inp; diff --git a/src/core/mem.c b/src/core/mem.c index 9962e754..b2ddd98e 100644 --- a/src/core/mem.c +++ b/src/core/mem.c @@ -641,7 +641,7 @@ mem_malloc_adjust_lfree: } #if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT /* if we got interrupted by a mem_free, try again */ - } while(local_mem_free_count != 0); + } while (local_mem_free_count != 0); #endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ LWIP_DEBUGF(MEM_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("mem_malloc: could not allocate %"S16_F" bytes\n", (s16_t)size)); MEM_STATS_INC(err); diff --git a/src/core/netif.c b/src/core/netif.c index 3fd945ec..be4ac196 100644 --- a/src/core/netif.c +++ b/src/core/netif.c @@ -396,7 +396,7 @@ netif_find(const char *name) num = name[2] - '0'; - for(netif = netif_list; netif != NULL; netif = netif->next) { + for (netif = netif_list; netif != NULL; netif = netif->next) { if (num == netif->num && name[0] == netif->name[0] && name[1] == netif->name[1]) { diff --git a/src/core/pbuf.c b/src/core/pbuf.c index 5564e956..ba747c76 100644 --- a/src/core/pbuf.c +++ b/src/core/pbuf.c @@ -973,7 +973,7 @@ pbuf_copy_partial(struct pbuf *buf, void *dataptr, u16_t len, u16_t offset) } /* Note some systems use byte copy if dataptr or one of the pbuf payload pointers are unaligned. */ - for(p = buf; len != 0 && p != NULL; p = p->next) { + for (p = buf; len != 0 && p != NULL; p = p->next) { if ((offset != 0) && (offset >= p->len)) { /* don't copy from this buffer -> on to the next */ offset -= p->len; @@ -1095,7 +1095,7 @@ pbuf_take(struct pbuf *buf, const void *dataptr, u16_t len) } /* Note some systems use byte copy if dataptr or one of the pbuf payload pointers are unaligned. */ - for(p = buf; total_copy_len != 0; p = p->next) { + for (p = buf; total_copy_len != 0; p = p->next) { LWIP_ASSERT("pbuf_take: invalid pbuf", p != NULL); buf_copy_len = total_copy_len; if (buf_copy_len > p->len) { @@ -1277,7 +1277,7 @@ pbuf_memcmp(struct pbuf* p, u16_t offset, const void* s2, u16_t n) /* return requested data if pbuf is OK */ if ((q != NULL) && (q->len > start)) { u16_t i; - for(i = 0; i < n; i++) { + for (i = 0; i < n; i++) { u8_t a = pbuf_get_at(q, start + i); u8_t b = ((const u8_t*)s2)[i]; if (a != b) { @@ -1305,7 +1305,7 @@ pbuf_memfind(struct pbuf* p, const void* mem, u16_t mem_len, u16_t start_offset) u16_t i; u16_t max = p->tot_len - mem_len; if (p->tot_len >= mem_len + start_offset) { - for(i = start_offset; i <= max; i++) { + for (i = start_offset; i <= max; i++) { u16_t plus = pbuf_memcmp(p, i, mem, mem_len); if (plus == 0) { return i; diff --git a/src/core/raw.c b/src/core/raw.c index 8e3f533d..b61b57cb 100644 --- a/src/core/raw.c +++ b/src/core/raw.c @@ -378,7 +378,7 @@ raw_remove(struct raw_pcb *pcb) raw_pcbs = raw_pcbs->next; /* pcb not 1st in list */ } else { - for(pcb2 = raw_pcbs; pcb2 != NULL; pcb2 = pcb2->next) { + for (pcb2 = raw_pcbs; pcb2 != NULL; pcb2 = pcb2->next) { /* find pcb in raw_pcbs list */ if (pcb2->next != NULL && pcb2->next == pcb) { /* remove pcb from list */ diff --git a/src/core/tcp.c b/src/core/tcp.c index b94f2e19..eee80fdd 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -475,7 +475,7 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) /* Check if the address already is in use (on all lists) */ for (i = 0; i < max_pcb_list; i++) { - for(cpcb = *tcp_pcb_lists[i]; cpcb != NULL; cpcb = cpcb->next) { + for (cpcb = *tcp_pcb_lists[i]; cpcb != NULL; cpcb = cpcb->next) { if (cpcb->local_port == port) { #if SO_REUSE /* Omit checking for the same port if both pcbs have REUSEADDR set. @@ -551,7 +551,7 @@ tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog) /* Since SOF_REUSEADDR allows reusing a local address before the pcb's usage is declared (listen-/connection-pcb), we have to make sure now that this port is only used once for every local IP. */ - for(lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) { + for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) { if ((lpcb->local_port == pcb->local_port) && IP_PCB_IPVER_EQ(pcb, lpcb)) { if (ip_addr_cmp(&lpcb->local_ip, &pcb->local_ip)) { @@ -607,7 +607,7 @@ tcp_listen_dual_with_backlog(struct tcp_pcb *pcb, u8_t backlog) if (pcb->local_port != 0) { /* Check that there's noone listening on this port already (don't check the IP address since we'll set it to ANY */ - for(l = tcp_listen_pcbs.listen_pcbs; l != NULL; l = l->next) { + for (l = tcp_listen_pcbs.listen_pcbs; l != NULL; l = l->next) { if (l->local_port == pcb->local_port) { /* this port is already used */ return NULL; @@ -723,7 +723,7 @@ again: } /* Check all PCB lists. */ for (i = 0; i < NUM_TCP_PCB_LISTS; i++) { - for(pcb = *tcp_pcb_lists[i]; pcb != NULL; pcb = pcb->next) { + for (pcb = *tcp_pcb_lists[i]; pcb != NULL; pcb = pcb->next) { if (pcb->local_port == tcp_port) { if (++n > (TCP_LOCAL_PORT_RANGE_END - TCP_LOCAL_PORT_RANGE_START)) { return 0; @@ -800,7 +800,7 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port, int i; /* Don't check listen- and bound-PCBs, check active- and TIME-WAIT PCBs. */ for (i = 2; i < NUM_TCP_PCB_LISTS; i++) { - for(cpcb = *tcp_pcb_lists[i]; cpcb != NULL; cpcb = cpcb->next) { + for (cpcb = *tcp_pcb_lists[i]; cpcb != NULL; cpcb = cpcb->next) { if ((cpcb->local_port == pcb->local_port) && (cpcb->remote_port == port) && IP_PCB_IPVER_EQ(cpcb, pcb) && @@ -1131,7 +1131,7 @@ tcp_fasttmr(void) tcp_fasttmr_start: pcb = tcp_active_pcbs; - while(pcb != NULL) { + while (pcb != NULL) { if (pcb->last_timer != tcp_timer_ctr) { struct tcp_pcb *next; pcb->last_timer = tcp_timer_ctr; @@ -1340,7 +1340,7 @@ tcp_kill_prio(u8_t prio) /* We kill the oldest active connection that has lower priority than prio. */ inactivity = 0; inactive = NULL; - for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) { + for (pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) { if (pcb->prio <= prio && pcb->prio <= mprio && (u32_t)(tcp_ticks - pcb->tmr) >= inactivity) { @@ -1372,7 +1372,7 @@ tcp_kill_state(enum tcp_state state) inactive = NULL; /* Go through the list of active pcbs and get the oldest pcb that is in state CLOSING/LAST_ACK. */ - for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) { + for (pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) { if (pcb->state == state) { if ((u32_t)(tcp_ticks - pcb->tmr) >= inactivity) { inactivity = tcp_ticks - pcb->tmr; @@ -1401,7 +1401,7 @@ tcp_kill_timewait(void) inactivity = 0; inactive = NULL; /* Go through the list of TIME_WAIT pcbs and get the oldest pcb. */ - for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) { + for (pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) { if ((u32_t)(tcp_ticks - pcb->tmr) >= inactivity) { inactivity = tcp_ticks - pcb->tmr; inactive = pcb; @@ -1996,21 +1996,21 @@ tcp_debug_print_pcbs(void) { struct tcp_pcb *pcb; LWIP_DEBUGF(TCP_DEBUG, ("Active PCB states:\n")); - for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) { + for (pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) { LWIP_DEBUGF(TCP_DEBUG, ("Local port %"U16_F", foreign port %"U16_F" snd_nxt %"U32_F" rcv_nxt %"U32_F" ", pcb->local_port, pcb->remote_port, pcb->snd_nxt, pcb->rcv_nxt)); tcp_debug_print_state(pcb->state); } LWIP_DEBUGF(TCP_DEBUG, ("Listen PCB states:\n")); - for(pcb = (struct tcp_pcb *)tcp_listen_pcbs.pcbs; pcb != NULL; pcb = pcb->next) { + for (pcb = (struct tcp_pcb *)tcp_listen_pcbs.pcbs; pcb != NULL; pcb = pcb->next) { LWIP_DEBUGF(TCP_DEBUG, ("Local port %"U16_F", foreign port %"U16_F" snd_nxt %"U32_F" rcv_nxt %"U32_F" ", pcb->local_port, pcb->remote_port, pcb->snd_nxt, pcb->rcv_nxt)); tcp_debug_print_state(pcb->state); } LWIP_DEBUGF(TCP_DEBUG, ("TIME-WAIT PCB states:\n")); - for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) { + for (pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) { LWIP_DEBUGF(TCP_DEBUG, ("Local port %"U16_F", foreign port %"U16_F" snd_nxt %"U32_F" rcv_nxt %"U32_F" ", pcb->local_port, pcb->remote_port, pcb->snd_nxt, pcb->rcv_nxt)); @@ -2025,12 +2025,12 @@ s16_t tcp_pcbs_sane(void) { struct tcp_pcb *pcb; - for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) { + for (pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) { LWIP_ASSERT("tcp_pcbs_sane: active pcb->state != CLOSED", pcb->state != CLOSED); LWIP_ASSERT("tcp_pcbs_sane: active pcb->state != LISTEN", pcb->state != LISTEN); LWIP_ASSERT("tcp_pcbs_sane: active pcb->state != TIME-WAIT", pcb->state != TIME_WAIT); } - for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) { + for (pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) { LWIP_ASSERT("tcp_pcbs_sane: tw pcb->state == TIME-WAIT", pcb->state == TIME_WAIT); } return 1; diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index 0dd0a6de..aedb2462 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -209,7 +209,7 @@ tcp_input(struct pbuf *p, struct netif *inp) for an active connection. */ prev = NULL; - for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) { + for (pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) { LWIP_ASSERT("tcp_input: active pcb->state != CLOSED", pcb->state != CLOSED); LWIP_ASSERT("tcp_input: active pcb->state != TIME-WAIT", pcb->state != TIME_WAIT); LWIP_ASSERT("tcp_input: active pcb->state != LISTEN", pcb->state != LISTEN); @@ -237,7 +237,7 @@ tcp_input(struct pbuf *p, struct netif *inp) if (pcb == NULL) { /* If it did not go to an active connection, we check the connections in the TIME-WAIT state. */ - for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) { + for (pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) { LWIP_ASSERT("tcp_input: TIME-WAIT pcb->state == TIME-WAIT", pcb->state == TIME_WAIT); if (pcb->remote_port == tcphdr->src && pcb->local_port == tcphdr->dest && @@ -256,7 +256,7 @@ tcp_input(struct pbuf *p, struct netif *inp) /* Finally, if we still did not get a match, we check all PCBs that are LISTENing for incoming connections. */ prev = NULL; - for(lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) { + for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) { if (lpcb->local_port == tcphdr->dest) { #if LWIP_IPV4 && LWIP_IPV6 if (lpcb->accept_any_ip_version) { @@ -378,7 +378,7 @@ tcp_input(struct pbuf *p, struct netif *inp) /* pcb->acked is u32_t but the sent callback only takes a u16_t, so we might have to call it multiple times. */ u32_t pcb_acked = pcb->acked; - while(pcb_acked > 0) { + while (pcb_acked > 0) { acked = (u16_t)LWIP_MIN(pcb_acked, 0xffffu); pcb_acked -= acked; #else @@ -1514,7 +1514,7 @@ tcp_receive(struct tcp_pcb *pcb) contains less data. */ prev = NULL; - for(next = pcb->ooseq; next != NULL; next = next->next) { + for (next = pcb->ooseq; next != NULL; next = next->next) { if (seqno == next->tcphdr->seqno) { /* The sequence number of the incoming segment is the same as the sequence number of the segment on @@ -1623,7 +1623,7 @@ tcp_receive(struct tcp_pcb *pcb) ooseq_blen = 0; ooseq_qlen = 0; prev = NULL; - for(next = pcb->ooseq; next != NULL; prev = next, next = next->next) { + for (next = pcb->ooseq; next != NULL; prev = next, next = next->next) { struct pbuf *p = next->p; ooseq_blen += p->tot_len; ooseq_qlen += pbuf_clen(p); diff --git a/src/core/timers.c b/src/core/timers.c index 7afeff05..ebaae508 100644 --- a/src/core/timers.c +++ b/src/core/timers.c @@ -374,7 +374,7 @@ sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg) timeout->next = next_timeout; next_timeout = timeout; } else { - for(t = next_timeout; t != NULL; t = t->next) { + for (t = next_timeout; t != NULL; t = t->next) { timeout->time -= t->time; if (t->next == NULL || t->next->time > timeout->time) { if (t->next != NULL) { @@ -473,7 +473,7 @@ sys_check_timeouts(void) } } /* repeat until all expired timers have been called */ - } while(had_one); + } while (had_one); } } diff --git a/src/core/udp.c b/src/core/udp.c index 35986611..5b95e25e 100644 --- a/src/core/udp.c +++ b/src/core/udp.c @@ -109,7 +109,7 @@ again: udp_port = UDP_LOCAL_PORT_RANGE_START; } /* Check all PCBs. */ - for(pcb = udp_pcbs; pcb != NULL; pcb = pcb->next) { + for (pcb = udp_pcbs; pcb != NULL; pcb = pcb->next) { if (pcb->local_port == udp_port) { if (++n > (UDP_LOCAL_PORT_RANGE_END - UDP_LOCAL_PORT_RANGE_START)) { return 0; @@ -735,7 +735,7 @@ udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *d #if LWIP_IPV6 !PCB_ISIPV6(pcb) && #endif /* LWIP_IPV6 */ - ip_addr_isbroadcast(dst_ip, netif) ) { + ip_addr_isbroadcast(dst_ip, netif)) { LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("udp_sendto_if: SOF_BROADCAST not enabled on pcb %p\n", (void *)pcb)); return ERR_VAL; diff --git a/src/include/lwip/tcp_impl.h b/src/include/lwip/tcp_impl.h index 50a77a40..5afcbc6c 100644 --- a/src/include/lwip/tcp_impl.h +++ b/src/include/lwip/tcp_impl.h @@ -376,7 +376,7 @@ extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */ #if TCP_DEBUG_PCB_LISTS #define TCP_REG(pcbs, npcb) do {\ LWIP_DEBUGF(TCP_DEBUG, ("TCP_REG %p local port %d\n", (npcb), (npcb)->local_port)); \ - for(tcp_tmp_pcb = *(pcbs); \ + for (tcp_tmp_pcb = *(pcbs); \ tcp_tmp_pcb != NULL; \ tcp_tmp_pcb = tcp_tmp_pcb->next) { \ LWIP_ASSERT("TCP_REG: already registered\n", tcp_tmp_pcb != (npcb)); \ @@ -393,7 +393,7 @@ extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */ LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removing %p from %p\n", (npcb), *(pcbs))); \ if(*(pcbs) == (npcb)) { \ *(pcbs) = (*pcbs)->next; \ - } else for(tcp_tmp_pcb = *(pcbs); tcp_tmp_pcb != NULL; tcp_tmp_pcb = tcp_tmp_pcb->next) { \ + } else for (tcp_tmp_pcb = *(pcbs); tcp_tmp_pcb != NULL; tcp_tmp_pcb = tcp_tmp_pcb->next) { \ if(tcp_tmp_pcb->next == (npcb)) { \ tcp_tmp_pcb->next = (npcb)->next; \ break; \ @@ -419,7 +419,7 @@ extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */ (*(pcbs)) = (*pcbs)->next; \ } \ else { \ - for(tcp_tmp_pcb = *pcbs; \ + for (tcp_tmp_pcb = *pcbs; \ tcp_tmp_pcb != NULL; \ tcp_tmp_pcb = tcp_tmp_pcb->next) { \ if(tcp_tmp_pcb->next == (npcb)) { \ diff --git a/src/netif/ethernetif.c b/src/netif/ethernetif.c index 66e00c8f..d3012535 100644 --- a/src/netif/ethernetif.c +++ b/src/netif/ethernetif.c @@ -145,7 +145,7 @@ low_level_output(struct netif *netif, struct pbuf *p) pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */ #endif - for(q = p; q != NULL; q = q->next) { + for (q = p; q != NULL; q = q->next) { /* Send the data from the pbuf to the interface, one pbuf at a time. The size of the data in each pbuf is kept in the ->len variable. */ @@ -197,7 +197,7 @@ low_level_input(struct netif *netif) /* We iterate over the pbuf chain until we have read the entire * packet into the pbuf. */ - for(q = p; q != NULL; q = q->next) { + for (q = p; q != NULL; q = q->next) { /* Read enough bytes to fill this pbuf in the chain. The * available data in the pbuf is given by the q->len * variable. diff --git a/src/netif/slipif.c b/src/netif/slipif.c index e3b9a122..970fd2c5 100644 --- a/src/netif/slipif.c +++ b/src/netif/slipif.c @@ -485,7 +485,7 @@ slipif_rxbyte_enqueue(struct netif *netif, u8_t data) #if SLIP_RX_QUEUE /* queue multiple pbufs */ struct pbuf *q = p; - while(q->next != NULL) { + while (q->next != NULL) { q = q->next; } q->next = p;