MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / pbuf_free_header

Function pbuf_free_header

components/net/lwip/lwip-2.1.2/src/core/pbuf.c:670–688  ·  view source on GitHub ↗

Similar to pbuf_header(-size) but de-refs header pbufs for (size >= p->len) * * @param q pbufs to operate on * @param size The number of bytes to remove from the beginning of the pbuf list. * While size >= p->len, pbufs are freed. * ATTENTION: this is the opposite direction as @ref pbuf_header, but * takes an u16_t not s16_t! * @return the new head pbuf

Source from the content-addressed store, hash-verified

668 * @return the new head pbuf
669 */
670struct pbuf *
671pbuf_free_header(struct pbuf *q, u16_t size)
672{
673 struct pbuf *p = q;
674 u16_t free_left = size;
675 while (free_left && p) {
676 if (free_left >= p->len) {
677 struct pbuf *f = p;
678 free_left = (u16_t)(free_left - p->len);
679 p = p->next;
680 f->next = 0;
681 pbuf_free(f);
682 } else {
683 pbuf_remove_header(p, free_left);
684 free_left = 0;
685 }
686 }
687 return p;
688}
689
690/**
691 * @ingroup pbuf

Callers 2

httpc_tcp_recvFunction · 0.85
lwip_recv_tcpFunction · 0.85

Calls 2

pbuf_remove_headerFunction · 0.85
pbuf_freeFunction · 0.70

Tested by

no test coverage detected