From 6f28a874b80f8206a0073e2295eec20fb778ccc6 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 7 Jul 2017 13:52:25 +0800 Subject: [PATCH] pbuf: Simplify pbuf_alloc a bit No need to have additional if statement for PBUF_REF/PBUF_ROM. It can be merged to the existing swtich(type) cases. Signed-off-by: Axel Lin --- src/core/pbuf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/core/pbuf.c b/src/core/pbuf.c index a263864c..4e21d47e 100644 --- a/src/core/pbuf.c +++ b/src/core/pbuf.c @@ -224,11 +224,10 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type) u16_t offset = (u16_t)layer; LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_alloc(length=%"U16_F")\n", length)); - if ((type == PBUF_REF) || (type == PBUF_ROM)) { - return pbuf_alloc_reference(NULL, length, type); - } - switch (type) { + case PBUF_REF: + case PBUF_ROM: + return pbuf_alloc_reference(NULL, length, type); case PBUF_POOL: { struct pbuf *q, *last;