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