loopif_output(): use pbuf_copy() to copy the pbuf to reduce code size

This commit is contained in:
goldsimon 2007-06-08 17:24:58 +00:00
parent 945460c67e
commit 8e65fb920f

View File

@ -125,8 +125,8 @@ loopif_output(struct netif *netif, struct pbuf *p,
SYS_ARCH_DECL_PROTECT(lev); SYS_ARCH_DECL_PROTECT(lev);
struct loopif_private *priv; struct loopif_private *priv;
#endif /* LWIP_LOOPIF_MULTITHREADING */ #endif /* LWIP_LOOPIF_MULTITHREADING */
struct pbuf *q, *r; struct pbuf *r;
u8_t *ptr; err_t err;
LWIP_UNUSED_ARG(ipaddr); LWIP_UNUSED_ARG(ipaddr);
@ -137,13 +137,10 @@ loopif_output(struct netif *netif, struct pbuf *p,
} }
/* Copy the whole pbuf queue p into the single pbuf r */ /* Copy the whole pbuf queue p into the single pbuf r */
/* @todo: - extend this so that r can be a pbuf list also if ((err = pbuf_copy(r, p)) != ERR_OK) {
* - could use pbuf_copy() for that! pbuf_free(r);
*/ r = NULL;
ptr = r->payload; return err;
for(q = p; q != NULL; q = q->next) {
MEMCPY(ptr, q->payload, q->len);
ptr += q->len;
} }
#if LWIP_LOOPIF_MULTITHREADING #if LWIP_LOOPIF_MULTITHREADING