/* Remove an element from the start of the ringbuffer. 
This helper function does not check the pre-requirements for reading, i.e. the caller has to ensure that ringbuffer_empty() is false.  */
static char get_head(ringbuffer_t *restrict rb)
/* Remove an element from the start of the ringbuffer. 
This helper function does not check the pre-requirements for reading, i.e. the caller has to ensure that ringbuffer_empty() is false.  */
static char get_head(ringbuffer_t *restrict rb)
{
    char result = rb->buf[rb->start];
    if ((--rb->avail == 0) || (++rb->start == rb->size)) {
        rb->start = 0;
    }
    return result;
}