/[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.74 by likewise, Thu Nov 25 11:23:37 2004 UTC revision 1.75 by likewise, Mon Dec 27 14:42:02 2004 UTC
# Line 183  pbuf_pool_alloc(void) Line 183  pbuf_pool_alloc(void)
183    
184    
185  /**  /**
186   * Allocates a pbuf.   * Allocates a pbuf of the given type (possibly a chain for PBUF_POOL type).
187   *   *
188   * The actual memory allocated for the pbuf is determined by the   * The actual memory allocated for the pbuf is determined by the
189   * layer at which the pbuf is allocated and the requested size   * layer at which the pbuf is allocated and the requested size
# Line 319  pbuf_alloc(pbuf_layer l, u16_t length, p Line 319  pbuf_alloc(pbuf_layer l, u16_t length, p
319      LWIP_ASSERT("pbuf_alloc: pbuf->payload properly aligned",      LWIP_ASSERT("pbuf_alloc: pbuf->payload properly aligned",
320             ((mem_ptr_t)p->payload % MEM_ALIGNMENT) == 0);             ((mem_ptr_t)p->payload % MEM_ALIGNMENT) == 0);
321      break;      break;
322    /* pbuf references existing (static constant) ROM payload? */    /* pbuf references existing (non-volatile static constant) ROM payload? */
323    case PBUF_ROM:    case PBUF_ROM:
324    /* pbuf references existing (externally allocated) RAM payload? */    /* pbuf references existing (externally allocated) RAM payload? */
325    case PBUF_REF:    case PBUF_REF:
# Line 664  pbuf_cat(struct pbuf *h, struct pbuf *t) Line 664  pbuf_cat(struct pbuf *h, struct pbuf *t)
664  {  {
665    struct pbuf *p;    struct pbuf *p;
666    
667    LWIP_ASSERT("h != NULL", h != NULL);    LWIP_ASSERT("h != NULL (programmer violates API)", h != NULL);
668    LWIP_ASSERT("t != NULL", t != NULL);    LWIP_ASSERT("t != NULL (programmer violates API)", t != NULL);
669    if ((h == NULL) || (t == NULL)) return;    if ((h == NULL) || (t == NULL)) return;
670    
671    /* proceed to last pbuf of chain */    /* proceed to last pbuf of chain */
# Line 675  pbuf_cat(struct pbuf *h, struct pbuf *t) Line 675  pbuf_cat(struct pbuf *h, struct pbuf *t)
675    }    }
676    /* { p is last pbuf of first h chain, p->next == NULL } */    /* { p is last pbuf of first h chain, p->next == NULL } */
677    LWIP_ASSERT("p->tot_len == p->len (of last pbuf in chain)", p->tot_len == p->len);    LWIP_ASSERT("p->tot_len == p->len (of last pbuf in chain)", p->tot_len == p->len);
678      LWIP_ASSERT("p->next == NULL", p->next == NULL);
679    /* add total length of second chain to last pbuf total of first chain */    /* add total length of second chain to last pbuf total of first chain */
680    p->tot_len += t->tot_len;    p->tot_len += t->tot_len;
681    /* chain last pbuf of head (p) with first of tail (t) */    /* chain last pbuf of head (p) with first of tail (t) */
682    p->next = t;    p->next = t;
683      /* p->next now references t, but the caller will drop its reference to t,
684       * so netto there is no change to the reference count of t.
685       */
686  }  }
687    
688  /**  /**
# Line 792  pbuf_dequeue(struct pbuf *p) Line 796  pbuf_dequeue(struct pbuf *p)
796    /* { p->tot_len == p->len } => p is the last pbuf of the first packet */    /* { p->tot_len == p->len } => p is the last pbuf of the first packet */
797    /* remember next packet on queue in q */    /* remember next packet on queue in q */
798    q = p->next;    q = p->next;
799    /* dequeue p from queue */    /* dequeue packet p from queue */
800    p->next = NULL;    p->next = NULL;
801    /* any next packet on queue? */    /* any next packet on queue? */
802    if (q != NULL) {    if (q != NULL) {

Legend:
Removed from v.1.74  
changed lines
  Added in v.1.75

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