Replaced pbuf.c 1.34 pbuf_take() change by simpler alternative.

This commit is contained in:
likewise 2003-03-31 23:28:54 +00:00
parent 09ca7a181b
commit 4c3512c0a2

View File

@ -710,12 +710,10 @@ pbuf_chain(struct pbuf *h, struct pbuf *t)
LWIP_ASSERT("t != NULL", t != NULL); LWIP_ASSERT("t != NULL", t != NULL);
/* proceed to last pbuf of chain */ /* proceed to last pbuf of chain */
for (p = h; p->next != NULL; p = p->next) { for (p = h; p != NULL; p = p->next) {
/* add total length of second chain to all totals of first chain */ /* add total length of second chain to all totals of first chain */
p->tot_len += t->tot_len; p->tot_len += t->tot_len;
} }
/* add total length of second chain to last buffer tot_len in first chain */
p->tot_len += t->tot_len;
/* chain last pbuf of h chain (p) with first of tail (t) */ /* chain last pbuf of h chain (p) with first of tail (t) */
p->next = t; p->next = t;
@ -843,9 +841,7 @@ pbuf_take(struct pbuf *f)
*/ */
pbuf_free(p); pbuf_free(p);
p = q; p = q;
} } else {
else
{
/* deallocate chain */ /* deallocate chain */
pbuf_free(top); pbuf_free(top);
DEBUGF(PBUF_DEBUG | 2, ("pbuf_take: failed to allocate replacement pbuf for %p\n", (void *)p)); DEBUGF(PBUF_DEBUG | 2, ("pbuf_take: failed to allocate replacement pbuf for %p\n", (void *)p));