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 <axel.lin@ingics.com>
This commit is contained in:
Axel Lin 2017-07-07 13:52:25 +08:00 committed by Dirk Ziegelmeier
parent f3c860958f
commit 6f28a874b8

View File

@ -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;