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 <axel.lin@ingics.com>
This commit is contained in:
Axel Lin 2015-11-18 17:10:33 +08:00 committed by goldsimon
parent 3f49b85680
commit 21b9b5e741
2 changed files with 2 additions and 0 deletions

View File

@ -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;
}
}
}

View File

@ -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;
}
}
}