mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-08-10 01:23:48 +08:00
Use pbuf_clone to replace pbuf_alloc+pbuf_copy
Use pbuf_clone() to simplify the code a bit. Signed-off-by: Axel Lin <axel.lin@ingics.com>
This commit is contained in:
committed by
Dirk Ziegelmeier
parent
4cfef8acab
commit
61e90d9fc0
@@ -1012,13 +1012,7 @@ etharp_query(struct netif *netif, const ip4_addr_t *ipaddr, struct pbuf *q)
|
||||
}
|
||||
if (copy_needed) {
|
||||
/* copy the whole packet into new pbufs */
|
||||
p = pbuf_alloc(PBUF_LINK, q->tot_len, PBUF_RAM);
|
||||
if (p != NULL) {
|
||||
if (pbuf_copy(p, q) != ERR_OK) {
|
||||
pbuf_free(p);
|
||||
p = NULL;
|
||||
}
|
||||
}
|
||||
p = pbuf_clone(PBUF_LINK, PBUF_RAM, q);
|
||||
} else {
|
||||
/* referencing the old pbuf is enough */
|
||||
p = q;
|
||||
|
||||
Reference in New Issue
Block a user