/[lwip]/lwip/src/core/pbuf.c
ViewVC logotype

Diff of /lwip/src/core/pbuf.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.45 by likewise, Tue Apr 15 12:38:48 2003 UTC revision 1.46 by likewise, Wed Apr 16 07:39:48 2003 UTC
# Line 529  pbuf_free(struct pbuf *p) Line 529  pbuf_free(struct pbuf *p)
529     */     */
530    SYS_ARCH_PROTECT(old_level);    SYS_ARCH_PROTECT(old_level);
531    /* de-allocate all consecutive pbufs from the head of the chain that    /* de-allocate all consecutive pbufs from the head of the chain that
532     * obtain a zero reference count */     * obtain a zero reference count after decrementing*/
533    while (p != NULL) {    while (p != NULL) {
534      /* all pbufs in a chain are referenced at least once */      /* all pbufs in a chain are referenced at least once */
535      LWIP_ASSERT("pbuf_free: p->ref > 0", p->ref > 0);      LWIP_ASSERT("pbuf_free: p->ref > 0", p->ref > 0);
536        /* decrease reference count (number of pointers to pbuf) */
537      p->ref--;      p->ref--;
538      /* this pbuf is no longer referenced to? */      /* this pbuf is no longer referenced to? */
539      if (p->ref == 0) {      if (p->ref == 0) {
# Line 543  pbuf_free(struct pbuf *p) Line 544  pbuf_free(struct pbuf *p)
544          p->len = p->tot_len = PBUF_POOL_BUFSIZE;          p->len = p->tot_len = PBUF_POOL_BUFSIZE;
545          p->payload = (void *)((u8_t *)p + sizeof(struct pbuf));          p->payload = (void *)((u8_t *)p + sizeof(struct pbuf));
546          PBUF_POOL_FREE(p);          PBUF_POOL_FREE(p);
547        /* a RAM/ROM referencing pbuf */        /* a ROM or RAM referencing pbuf */
548        } else if (p->flags == PBUF_FLAG_ROM || p->flags == PBUF_FLAG_REF) {        } else if (p->flags == PBUF_FLAG_ROM || p->flags == PBUF_FLAG_REF) {
549          memp_freep(MEMP_PBUF, p);          memp_freep(MEMP_PBUF, p);
550        /* pbuf with data */        /* p->flags == PBUF_FLAG_RAM */
551        } else {        } else {
552          mem_free(p);          mem_free(p);
553        }        }
# Line 554  pbuf_free(struct pbuf *p) Line 555  pbuf_free(struct pbuf *p)
555        /* proceed to next pbuf */        /* proceed to next pbuf */
556        p = q;        p = q;
557      /* p->ref > 0, this pbuf is still referenced to */      /* p->ref > 0, this pbuf is still referenced to */
558      /* (so the remaining pbufs in chain as well)    */      /* (and so the remaining pbufs in chain as well) */
559      } else {      } else {
560        /* stop walking through chain */        /* stop walking through chain */
561        p = NULL;        p = NULL;

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.46

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26