From 3f0b1e2cdc850194cf93567e02a90f6a1c721f0b Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Thu, 12 Nov 2015 08:07:22 +0100 Subject: [PATCH] Remove global variable used in macros, it can be declared locally. --- src/core/tcp.c | 3 --- src/include/lwip/priv/tcp_priv.h | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/core/tcp.c b/src/core/tcp.c index a477ef7d..e47bff07 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -115,9 +115,6 @@ struct tcp_pcb *tcp_tw_pcbs; struct tcp_pcb ** const tcp_pcb_lists[] = {&tcp_listen_pcbs.pcbs, &tcp_bound_pcbs, &tcp_active_pcbs, &tcp_tw_pcbs}; -/** Only used for temporary storage. */ -struct tcp_pcb *tcp_tmp_pcb; - u8_t tcp_active_pcbs_changed; /** Timer counter to handle calling slow-timer from tcp_tmr() */ diff --git a/src/include/lwip/priv/tcp_priv.h b/src/include/lwip/priv/tcp_priv.h index 5afcbc6c..af1a95cf 100644 --- a/src/include/lwip/priv/tcp_priv.h +++ b/src/include/lwip/priv/tcp_priv.h @@ -360,7 +360,6 @@ extern struct tcp_pcb *tcp_active_pcbs; /* List of all TCP PCBs that are in a data. */ extern struct tcp_pcb *tcp_tw_pcbs; /* List of all TCP PCBs in TIME-WAIT. */ -extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */ /* Axioms about the above lists: 1) Every TCP PCB that is not CLOSED is in one of the lists. @@ -375,6 +374,7 @@ extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */ #endif #if TCP_DEBUG_PCB_LISTS #define TCP_REG(pcbs, npcb) do {\ + struct tcp_pcb *tcp_tmp_pcb; \ LWIP_DEBUGF(TCP_DEBUG, ("TCP_REG %p local port %d\n", (npcb), (npcb)->local_port)); \ for (tcp_tmp_pcb = *(pcbs); \ tcp_tmp_pcb != NULL; \ @@ -389,6 +389,7 @@ extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */ tcp_timer_needed(); \ } while(0) #define TCP_RMV(pcbs, npcb) do { \ + struct tcp_pcb *tcp_tmp_pcb; \ LWIP_ASSERT("TCP_RMV: pcbs != NULL", *(pcbs) != NULL); \ LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removing %p from %p\n", (npcb), *(pcbs))); \ if(*(pcbs) == (npcb)) { \ @@ -419,6 +420,7 @@ extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */ (*(pcbs)) = (*pcbs)->next; \ } \ else { \ + struct tcp_pcb *tcp_tmp_pcb; \ for (tcp_tmp_pcb = *pcbs; \ tcp_tmp_pcb != NULL; \ tcp_tmp_pcb = tcp_tmp_pcb->next) { \