Lines Matching refs:q

209   struct pbuf *p, *q, *r;
272 q = (struct pbuf *)memp_malloc(MEMP_PBUF_POOL);
273 if (q == NULL) {
280 q->type = type;
281 q->flags = 0;
282 q->next = NULL;
284 r->next = q;
287 q->tot_len = (u16_t)rem_len;
289 q->len = LWIP_MIN((u16_t)rem_len, PBUF_POOL_BUFSIZE_ALIGNED);
290 q->payload = (void *)((u8_t *)q + SIZEOF_STRUCT_PBUF);
291 LWIP_ASSERT("pbuf_alloc: pbuf q->payload properly aligned",
292 ((mem_ptr_t)q->payload % MEM_ALIGNMENT) == 0);
296 q->ref = 1;
298 rem_len -= q->len;
300 r = q;
432 struct pbuf *q;
454 q = p;
456 while (rem_len > q->len) {
458 rem_len -= q->len;
461 q->tot_len += (u16_t)grow;
463 q = q->next;
464 LWIP_ASSERT("pbuf_realloc: q != NULL", q != NULL);
466 /* we have now reached the new last pbuf (in q) */
467 /* rem_len == desired length for pbuf q */
471 if ((q->type == PBUF_RAM) && (rem_len != q->len)) {
473 q = (struct pbuf *)mem_trim(q, (u16_t)((u8_t *)q->payload - (u8_t *)q) + rem_len);
474 LWIP_ASSERT("mem_trim returned q == NULL", q != NULL);
477 q->len = rem_len;
478 q->tot_len = q->len;
481 if (q->next != NULL) {
483 pbuf_free(q->next);
485 /* q is last packet in chain */
486 q->next = NULL;
621 struct pbuf *q;
657 q = p->next;
682 p = q;
805 struct pbuf *q;
808 q = p->next;
810 if (q != NULL) {
812 LWIP_ASSERT("p->tot_len == p->len + q->tot_len", q->tot_len == p->tot_len - p->len);
814 q->tot_len = p->tot_len - p->len;
819 /* q is no longer referenced by p, free it */
820 LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_dechain: unreferencing %p\n", (void *)q));
821 tail_gone = pbuf_free(q);
824 ("pbuf_dechain: deallocated %p (as it is no longer referenced)\n", (void *)q));
830 return ((tail_gone > 0) ? NULL : q);
1012 struct pbuf *q;
1017 q = pbuf_alloc(layer, p->tot_len, PBUF_RAM);
1018 if (q == NULL) {
1022 err = pbuf_copy(q, p);
1025 return q;
1080 struct pbuf* q = p;
1083 while ((q != NULL) && (q->len <= copy_from)) {
1084 copy_from -= q->len;
1085 q = q->next;
1088 if ((q != NULL) && (q->len > copy_from)) {
1089 return ((u8_t*)q->payload)[copy_from];
1107 struct pbuf* q = p;
1110 while ((q != NULL) && (q->len <= start)) {
1111 start -= q->len;
1112 q = q->next;
1115 if ((q != NULL) && (q->len > start)) {
1118 u8_t a = pbuf_get_at(q, start + i);