2008-02-04 00:13:34 +00:00
|
|
|
#ifndef _RINGBUFFER_H
|
|
|
|
#define _RINGBUFFER_H
|
2008-02-03 22:42:03 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/* 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;
|
|
|
|
} RINGBUFFER;
|
|
|
|
|
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
|