diff -r 4d641c6a2f82 -r ee5d668a71e4 src/cx/buffer.h --- a/src/cx/buffer.h Tue Nov 25 20:35:27 2025 +0100 +++ b/src/cx/buffer.h Wed Nov 26 23:06:12 2025 +0100 @@ -118,7 +118,7 @@ /** * The maximum number of blocks to flush in one cycle. * - * @attention while it is guaranteed that cxBufferFlush() will not flush + * @attention While it is guaranteed that cxBufferFlush() will not flush * more blocks, this is not necessarily the case for cxBufferWrite(). * After performing a flush cycle, cxBufferWrite() will retry the write * operation and potentially trigger another flush cycle, until the @@ -388,6 +388,20 @@ CX_EXPORT int cxBufferSeek(CxBuffer *buffer, off_t offset, int whence); /** + * Discards items from the end of the buffer. + * + * When the current position points to a byte that gets discarded, + * the position is set to the buffer size. + * + * @param buffer the buffer + * @param size the size of one item + * @param nitems the number of items to discard + * @return the actual number of discarded items + */ +cx_attr_nonnull +CX_EXPORT size_t cxBufferPop(CxBuffer *buffer, size_t size, size_t nitems); + +/** * Clears the buffer by resetting the position and deleting the data. * * The data is deleted by zeroing it with a call to memset().