X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/3b6a05fc894d0c1a3d431045ee5a53955ba093a0..8efc0cf32160c68772a2ce1887e6a397852d3d96:/lunaix-os/includes/lunaix/buffer.h?ds=sidebyside diff --git a/lunaix-os/includes/lunaix/buffer.h b/lunaix-os/includes/lunaix/buffer.h index 605cf8b..07176cd 100644 --- a/lunaix-os/includes/lunaix/buffer.h +++ b/lunaix-os/includes/lunaix/buffer.h @@ -35,11 +35,15 @@ vbuf_free(struct vecbuf* vbuf); * @return struct vecbuf* */ struct vecbuf* -vbuf_alloc(struct vecbuf* vec, void* buf, size_t len); +vbuf_alloc(struct vecbuf** vec, void* buf, size_t len); static inline size_t vbuf_size(struct vecbuf* vbuf) { + if (!vbuf) { + return 0; + } + struct vecbuf* last = list_entry(vbuf->components.prev, struct vecbuf, components); return last->acc_sz;