Lines Matching defs:balloc
32 void nghttp3_balloc_init(nghttp3_balloc *balloc, size_t blklen,
36 balloc->mem = mem;
37 balloc->blklen = blklen;
38 balloc->head = NULL;
39 nghttp3_buf_wrap_init(&balloc->buf, (void *)"", 0);
42 void nghttp3_balloc_free(nghttp3_balloc *balloc) {
43 if (balloc == NULL) {
47 nghttp3_balloc_clear(balloc);
50 void nghttp3_balloc_clear(nghttp3_balloc *balloc) {
53 for (p = balloc->head; p; p = next) {
55 nghttp3_mem_free(balloc->mem, p);
58 balloc->head = NULL;
59 nghttp3_buf_wrap_init(&balloc->buf, (void *)"", 0);
62 int nghttp3_balloc_get(nghttp3_balloc *balloc, void **pbuf, size_t n) {
66 assert(n <= balloc->blklen);
68 if (nghttp3_buf_left(&balloc->buf) < n) {
69 p = nghttp3_mem_malloc(balloc->mem, sizeof(nghttp3_memblock_hd) + 0x10u +
70 balloc->blklen);
76 hd->next = balloc->head;
77 balloc->head = hd;
79 &balloc->buf,
82 balloc->blklen);
85 assert(((uintptr_t)balloc->buf.last & 0xfu) == 0);
87 *pbuf = balloc->buf.last;
88 balloc->buf.last += (n + 0xfu) & ~(uintptr_t)0xfu;