From 4c3512c0a2178f09eb1f6666ff13571b5772d677 Mon Sep 17 00:00:00 2001 From: likewise Date: Mon, 31 Mar 2003 23:28:54 +0000 Subject: [PATCH] Replaced pbuf.c 1.34 pbuf_take() change by simpler alternative. --- src/core/pbuf.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/core/pbuf.c b/src/core/pbuf.c index d78e0362..dbc34bbf 100644 --- a/src/core/pbuf.c +++ b/src/core/pbuf.c @@ -710,13 +710,11 @@ pbuf_chain(struct pbuf *h, struct pbuf *t) LWIP_ASSERT("t != NULL", t != NULL); /* 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 */ 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) */ p->next = t; /* t is now referenced to one more time */ @@ -843,9 +841,7 @@ pbuf_take(struct pbuf *f) */ pbuf_free(p); p = q; - } - else - { + } else { /* deallocate chain */ pbuf_free(top); DEBUGF(PBUF_DEBUG | 2, ("pbuf_take: failed to allocate replacement pbuf for %p\n", (void *)p));