1 #include <lunaix/buffer.h>
2 #include <lunaix/mm/valloc.h>
5 vbuf_alloc(struct vecbuf* vec, void* buf, size_t size)
7 struct vecbuf* vbuf = valloc(sizeof(struct vecbuf));
9 *vbuf = (struct vecbuf){ .buf = { .buffer = buf, .size = size },
10 .acc_sz = vbuf_size(vec) + size };
13 llist_append(&vec->components, &vbuf->components);
15 llist_init_head(&vbuf->components);
22 vbuf_free(struct vecbuf* vbuf)
24 struct vecbuf *pos, *n;
25 llist_for_each(pos, n, &vbuf->components, components)