PPP, VJ: Use pbuf_take instead of duplicate copy code

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
This commit is contained in:
Axel Lin 2017-06-16 09:39:16 +08:00 committed by goldsimon
parent fc23257ca0
commit faf74b36a4

View File

@ -632,8 +632,7 @@ vj_uncompress_tcp(struct pbuf **nb, struct vjcompress *comp)
} }
if(LWIP_MEM_ALIGN(n0->payload) != n0->payload) { if(LWIP_MEM_ALIGN(n0->payload) != n0->payload) {
struct pbuf *np, *q; struct pbuf *np;
u8_t *bufptr;
#if IP_FORWARD #if IP_FORWARD
/* If IP forwarding is enabled we are using a PBUF_LINK packet type so /* If IP forwarding is enabled we are using a PBUF_LINK packet type so
@ -655,11 +654,7 @@ vj_uncompress_tcp(struct pbuf **nb, struct vjcompress *comp)
goto bad; goto bad;
} }
bufptr = (u8_t*)n0->payload; pbuf_take(np, n0->payload, n0->len);
for(q = np; q != NULL; q = q->next) {
MEMCPY(q->payload, bufptr, q->len);
bufptr += q->len;
}
if(n0->next) { if(n0->next) {
pbuf_chain(np, n0->next); pbuf_chain(np, n0->next);