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));
8 struct vecbuf* _vec = *vec;
10 *vbuf = (struct vecbuf){ .buf = { .buffer = buf, .size = size },
11 .acc_sz = vbuf_size(_vec) + size };
14 llist_append(&_vec->components, &vbuf->components);
16 llist_init_head(&vbuf->components);
24 vbuf_free(struct vecbuf* vbuf)
26 struct vecbuf *pos, *n;
27 llist_for_each(pos, n, &vbuf->components, components)