pbuf_copy(): Corrected a wrong comment & try to behave correctly if LWIP_NOASSERT is defined

This commit is contained in:
goldsimon 2007-06-08 17:27:36 +00:00
parent 8e65fb920f
commit 0b9c9f9ede

View File

@ -669,7 +669,9 @@ pbuf_dechain(struct pbuf *p)
* *
* @param p Head of pbuf chain to process * @param p Head of pbuf chain to process
* *
* @return Pointer to head of pbuf chain * @return ERR_OK if pbuf was copied
* ERR_ARG if one of the pbufs is NULL or p_to is not big
* enough to hold p_from
*/ */
err_t err_t
pbuf_copy(struct pbuf *p_to, struct pbuf *p_from) pbuf_copy(struct pbuf *p_to, struct pbuf *p_from)
@ -727,11 +729,13 @@ pbuf_copy(struct pbuf *p_to, struct pbuf *p_from)
/* don't copy more than one packet! */ /* don't copy more than one packet! */
LWIP_ASSERT("pbuf_copy() does not allow packet queues!\n", LWIP_ASSERT("pbuf_copy() does not allow packet queues!\n",
p_from->next == NULL); p_from->next == NULL);
return ERR_VAL;
} }
if((p_to != NULL) && (p_to->len == p_to->tot_len)) { if((p_to != NULL) && (p_to->len == p_to->tot_len)) {
/* don't copy more than one packet! */ /* don't copy more than one packet! */
LWIP_ASSERT("pbuf_copy() does not allow packet queues!\n", LWIP_ASSERT("pbuf_copy() does not allow packet queues!\n",
p_to->next == NULL); p_to->next == NULL);
return ERR_VAL;
} }
} while (p_from); } while (p_from);
LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE | 1, ("pbuf_copy: end of chain reached.\n")); LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE | 1, ("pbuf_copy: end of chain reached.\n"));