blob: 9c2ce9c350d087ca50c482f2a61d8c1b464d799e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
typedef struct
{
/* what you need */
struct RBITEM_t *next_alloc;
struct RBITEM_t *last_alloc;
struct RBITEM_t *first;
struct RBITEM_t *last;
void *memory;
int size;
} RINGBUFFER;
RINGBUFFER *ringbuf_init(void *memory, int size);
void *ringbuf_allocate(RINGBUFFER *rb, int size);
void ringbuf_validate(RINGBUFFER *rb);
void *ringbuf_item_ptr(void *p);
void *ringbuf_prev(RINGBUFFER *rb, void *current);
void *ringbuf_next(RINGBUFFER *rb, void *current);
void *ringbuf_first(RINGBUFFER *rb);
void *ringbuf_last(RINGBUFFER *rb);
|