vis: improve cursor alignment command <C-a>
[vis.git] / ring-buffer.h
blobcfd70e0fc9775347306b3b1ade441cf8c924c0aa
1 #ifndef RING_BUFFER_H
2 #define RING_BUFFER_H
4 #include <stdbool.h>
5 #include <stddef.h>
7 /*
8 * Circular buffer with functions for accessing elements in order.
9 * One slot always remains unused to distinguish between the empty/full case.
12 typedef struct RingBuffer RingBuffer;
14 RingBuffer *ringbuf_alloc(size_t size);
15 void ringbuf_free(RingBuffer*);
16 void ringbuf_add(RingBuffer*, const void *value);
17 const void *ringbuf_prev(RingBuffer*);
18 const void *ringbuf_next(RingBuffer*);
19 void ringbuf_invalidate(RingBuffer*);
21 #endif