mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-27 12:35:26 +00:00
PPP: use pbuf_coalesce() instead of private ppp_singlebuf()
pbuf_coalesce() creates a single pbuf out of a chain of pbufs, which is exactly what ppp_singlebuf() need. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Sylvain Rochet <gradator@gradator.net>
This commit is contained in:
parent
a942582b4b
commit
3e909bafa8
@ -973,28 +973,7 @@ out:
|
||||
|
||||
/* merge a pbuf chain into one pbuf */
|
||||
struct pbuf *ppp_singlebuf(struct pbuf *p) {
|
||||
struct pbuf *q, *b;
|
||||
u8_t *pl;
|
||||
|
||||
if(p->tot_len == p->len) {
|
||||
return p;
|
||||
}
|
||||
|
||||
q = pbuf_alloc(PBUF_RAW, p->tot_len, PBUF_RAM);
|
||||
if(!q) {
|
||||
PPPDEBUG(LOG_ERR,
|
||||
("ppp_singlebuf: unable to alloc new buf (%d)\n", p->tot_len));
|
||||
return p; /* live dangerously */
|
||||
}
|
||||
|
||||
for(b = p, pl = (u8_t*)q->payload; b != NULL; b = b->next) {
|
||||
MEMCPY(pl, b->payload, b->len);
|
||||
pl += b->len;
|
||||
}
|
||||
|
||||
pbuf_free(p);
|
||||
|
||||
return q;
|
||||
return pbuf_coalesce(p, PBUF_RAW);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user