--- a/docs/Writerside/topics/buffer.h.md Tue Nov 25 20:35:27 2025 +0100 +++ b/docs/Writerside/topics/buffer.h.md Wed Nov 26 23:06:12 2025 +0100 @@ -220,6 +220,9 @@ void cxBufferReset(CxBuffer *buffer); void cxBufferClear(CxBuffer *buffer); + +size_t cxBufferPop(CxBuffer *buffer, + size_t size, size_t nitems); ``` The function `cxBufferReset()` sets both size and position of the buffer to zero, @@ -228,6 +231,10 @@ > When clearing the buffer, only the "live" data, i.e., bytes with indices `[0..size)`, are cleared. > If you want to clear the entire buffer's memory, you would need to set the size to the capacity, first. +The function `cxBufferPop()` erases the last `nitems` with the given `size` and returns the number of items that could be erased. +When the buffer contains fewer bytes than requested and the number of bytes is not divisible by the item `size`, +the remainder will stay in the buffer. + > If the `CX_BUFFER_COPY_ON_WRITE` flag is set, `cxBufferClear()` behaves exactly like `cxBufferReset()`, > because writing to the contents is disallowed. >{style="note"}