From 21b9b5e741a49756064fb985ad19a050f325961f Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 18 Nov 2015 17:10:33 +0800 Subject: [PATCH] Slightly improve raw_remove()/udp_remove() implementation There should be no duplicate pcb in raw_pcbs/udp_pcbs list. So the implementation of raw_remove()/udp_remove() can break from the for loop once the target pcb is found and removed from the list. Signed-off-by: Axel Lin --- src/core/raw.c | 1 + src/core/udp.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/core/raw.c b/src/core/raw.c index b61b57cb..1ebc0aca 100644 --- a/src/core/raw.c +++ b/src/core/raw.c @@ -383,6 +383,7 @@ raw_remove(struct raw_pcb *pcb) if (pcb2->next != NULL && pcb2->next == pcb) { /* remove pcb from list */ pcb2->next = pcb->next; + break; } } } diff --git a/src/core/udp.c b/src/core/udp.c index 0835ac75..e4d51221 100644 --- a/src/core/udp.c +++ b/src/core/udp.c @@ -1131,6 +1131,7 @@ udp_remove(struct udp_pcb *pcb) if (pcb2->next != NULL && pcb2->next == pcb) { /* remove pcb from list */ pcb2->next = pcb->next; + break; } } }