tcp.c: Remove side-effects from boolean expressions

This commit is contained in:
Dirk Ziegelmeier 2017-08-07 12:13:29 +02:00
parent b54bf3ccca
commit 79a08c9fee

View File

@ -873,14 +873,16 @@ tcp_new_port(void)
struct tcp_pcb *pcb;
again:
if (tcp_port++ == TCP_LOCAL_PORT_RANGE_END) {
tcp_port++;
if (tcp_port == TCP_LOCAL_PORT_RANGE_END) {
tcp_port = TCP_LOCAL_PORT_RANGE_START;
}
/* Check all PCB lists. */
for (i = 0; i < NUM_TCP_PCB_LISTS; i++) {
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)) {
n++;
if (n > (TCP_LOCAL_PORT_RANGE_END - TCP_LOCAL_PORT_RANGE_START)) {
return 0;
}
goto again;