[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] [PATCH trivial] TCP_RMV remove unnecessary check
From: |
Domen Puncer |
Subject: |
[lwip-users] [PATCH trivial] TCP_RMV remove unnecessary check |
Date: |
Wed, 30 Sep 2009 12:04:12 +0200 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
Hello!
Checking for NULL is useless, since npcb should not be NULL (after the
loop npcb->next is accessed unconditially).
---
src/include/lwip/tcp.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
Index: lwip/src/include/lwip/tcp.h
===================================================================
--- lwip.orig/src/include/lwip/tcp.h
+++ lwip/src/include/lwip/tcp.h
@@ -651,7 +651,7 @@ extern struct tcp_pcb *tcp_tmp_pcb;
if(*pcbs == npcb) { \
*pcbs = (*pcbs)->next; \
} else for(tcp_tmp_pcb = *pcbs; tcp_tmp_pcb !=
NULL; tcp_tmp_pcb = tcp_tmp_pcb->next) { \
- if(tcp_tmp_pcb->next != NULL &&
tcp_tmp_pcb->next == npcb) { \
+ if(tcp_tmp_pcb->next == npcb) { \
tcp_tmp_pcb->next = npcb->next; \
break; \
} \
@@ -676,10 +676,10 @@ extern struct tcp_pcb *tcp_tmp_pcb;
(*(pcbs)) = (*pcbs)->next; \
} \
else { \
- for(tcp_tmp_pcb = *pcbs; \
- tcp_tmp_pcb != NULL; \
- tcp_tmp_pcb = tcp_tmp_pcb->next) { \
- if(tcp_tmp_pcb->next != NULL && tcp_tmp_pcb->next == npcb) { \
+ 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; \
} \
- [lwip-users] [PATCH trivial] TCP_RMV remove unnecessary check,
Domen Puncer <=