From c144e5b1ec0256c2eba45ddb2f4665f20f3f8e9e Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sat, 29 Apr 2017 23:54:16 +0800 Subject: [PATCH] pbuf_coalesce: Replace pbuf_alloc+pbuf_copy with pbuf_clone Avoid duplicate the same implementation. Signed-off-by: Axel Lin Signed-off-by: goldsimon --- src/core/pbuf.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/core/pbuf.c b/src/core/pbuf.c index 3029bc3e..e36c344a 100644 --- a/src/core/pbuf.c +++ b/src/core/pbuf.c @@ -1262,18 +1262,14 @@ struct pbuf* pbuf_coalesce(struct pbuf *p, pbuf_layer layer) { struct pbuf *q; - err_t err; if (p->next == NULL) { return p; } - q = pbuf_alloc(layer, p->tot_len, PBUF_RAM); + q = pbuf_clone(layer, PBUF_RAM, p); if (q == NULL) { /* @todo: what do we do now? */ return p; } - err = pbuf_copy(q, p); - LWIP_UNUSED_ARG(err); /* in case of LWIP_NOASSERT */ - LWIP_ASSERT("pbuf_copy failed", err == ERR_OK); pbuf_free(p); return q; }