tcp_in: favour code block over #ifdef blocks for local variables only used in TCP_OOSEQ_MAX_BYTES || TCP_OOSEQ_MAX_PBUFS configs

This commit is contained in:
goldsimon 2017-09-21 09:50:47 +02:00
parent f48c71e17f
commit 6d2b181cc0

View File

@ -1097,7 +1097,7 @@ tcp_free_acked_segments(struct tcp_pcb *pcb, struct tcp_seg *seg_list, const cha
static void static void
tcp_receive(struct tcp_pcb *pcb) tcp_receive(struct tcp_pcb *pcb)
{ {
#if TCP_QUEUE_OOSEQ || TCP_OOSEQ_MAX_BYTES || TCP_OOSEQ_MAX_PBUFS #if TCP_QUEUE_OOSEQ
struct tcp_seg *next; struct tcp_seg *next;
#endif #endif
#if TCP_QUEUE_OOSEQ #if TCP_QUEUE_OOSEQ
@ -1106,10 +1106,6 @@ tcp_receive(struct tcp_pcb *pcb)
s16_t m; s16_t m;
u32_t right_wnd_edge; u32_t right_wnd_edge;
int found_dupack = 0; int found_dupack = 0;
#if TCP_OOSEQ_MAX_BYTES || TCP_OOSEQ_MAX_PBUFS
u32_t ooseq_blen;
u16_t ooseq_qlen;
#endif /* TCP_OOSEQ_MAX_BYTES || TCP_OOSEQ_MAX_PBUFS */
LWIP_ASSERT("tcp_receive: wrong state", pcb->state >= ESTABLISHED); LWIP_ASSERT("tcp_receive: wrong state", pcb->state >= ESTABLISHED);
@ -1782,10 +1778,11 @@ tcp_receive(struct tcp_pcb *pcb)
#endif /* LWIP_TCP_SACK_OUT */ #endif /* LWIP_TCP_SACK_OUT */
} }
#if TCP_OOSEQ_MAX_BYTES || TCP_OOSEQ_MAX_PBUFS #if TCP_OOSEQ_MAX_BYTES || TCP_OOSEQ_MAX_PBUFS
{
/* Check that the data on ooseq doesn't exceed one of the limits /* Check that the data on ooseq doesn't exceed one of the limits
and throw away everything above that limit. */ and throw away everything above that limit. */
ooseq_blen = 0; u32_t ooseq_blen = 0;
ooseq_qlen = 0; u16_t ooseq_qlen = 0;
prev = NULL; 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; struct pbuf *p = next->p;
@ -1811,6 +1808,7 @@ tcp_receive(struct tcp_pcb *pcb)
break; break;
} }
} }
}
#endif /* TCP_OOSEQ_MAX_BYTES || TCP_OOSEQ_MAX_PBUFS */ #endif /* TCP_OOSEQ_MAX_BYTES || TCP_OOSEQ_MAX_PBUFS */
#endif /* TCP_QUEUE_OOSEQ */ #endif /* TCP_QUEUE_OOSEQ */