2008-02-04 00:13:34 +00:00
|
|
|
#ifndef _RINGBUFFER_H
|
|
|
|
#define _RINGBUFFER_H
|
2008-02-03 22:42:03 +00:00
|
|
|
|
2008-08-27 19:50:33 +00:00
|
|
|
typedef struct RINGBUFFER
|
2008-02-03 22:42:03 +00:00
|
|
|
{
|
|
|
|
/* what you need */
|
2008-02-03 23:52:28 +00:00
|
|
|
struct RBITEM_t *next_alloc;
|
|
|
|
struct RBITEM_t *last_alloc;
|
|
|
|
struct RBITEM_t *first;
|
|
|
|
struct RBITEM_t *last;
|
2008-02-03 22:42:03 +00:00
|
|
|
void *memory;
|
|
|
|
int size;
|
2008-08-27 19:50:33 +00:00
|
|
|
} RINGBUFFER;
|
2008-02-03 22:42:03 +00:00
|
|
|
|
2008-02-03 23:55:37 +00:00
|
|
|
RINGBUFFER *ringbuf_init(void *memory, int size);
|
|
|
|
void *ringbuf_allocate(RINGBUFFER *rb, int size);
|
|
|
|
void ringbuf_validate(RINGBUFFER *rb);
|
2008-02-03 23:52:28 +00:00
|
|
|
|
2008-02-03 23:55:37 +00:00
|
|
|
void *ringbuf_item_ptr(void *p);
|
2008-02-03 22:42:03 +00:00
|
|
|
|
2008-02-03 23:55:37 +00:00
|
|
|
void *ringbuf_prev(RINGBUFFER *rb, void *current);
|
|
|
|
void *ringbuf_next(RINGBUFFER *rb, void *current);
|
|
|
|
void *ringbuf_first(RINGBUFFER *rb);
|
|
|
|
void *ringbuf_last(RINGBUFFER *rb);
|
2008-02-04 00:13:34 +00:00
|
|
|
|
|
|
|
#endif
|