diff options
author | Richard Braun <rbraun@sceen.net> | 2018-08-31 01:11:21 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2018-08-31 01:11:21 +0200 |
commit | 92e969d589e5dc44ae8ea8d2c087289eaa1a3f96 (patch) | |
tree | 7668556ca28b5ff867c2c5a51c07f798267f10a5 /src/cbuf.h | |
parent | 9d5114c068344962725b6d39319f4e68d855227d (diff) |
cbuf: new start/end assignment functions
Diffstat (limited to 'src/cbuf.h')
-rw-r--r-- | src/cbuf.h | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -23,7 +23,7 @@ * http://git.sceen.net/rbraun/librbraun.git/ * * - * Circular byte buffer. + * FIFO circular byte buffer. */ #ifndef CBUF_H @@ -160,4 +160,16 @@ int cbuf_write(struct cbuf *cbuf, size_t index, const void *buf, size_t size); */ int cbuf_read(const struct cbuf *cbuf, size_t index, void *buf, size_t *sizep); +/* + * Set the value of the start/end index. + * + * These functions provide low level access to the circular buffer boundaries + * while making sure its size doesn't exceed its capacity. + * + * Users should try and find a higher level way to manipulate the circular + * buffer, and only resort to using these functions if there's no other choice. + */ +void cbuf_set_start(struct cbuf *cbuf, size_t start); +void cbuf_set_end(struct cbuf *cbuf, size_t end); + #endif /* CBUF_H */ |