2008-02-04 00:13:34 +00:00
|
|
|
#ifndef _RINGBUFFER_H
|
|
|
|
#define _RINGBUFFER_H
|
2008-02-03 22:42:03 +00:00
|
|
|
|
2008-10-02 12:29:19 +00:00
|
|
|
typedef struct RINGBUFFER RINGBUFFER;
|
|
|
|
|
|
|
|
enum
|
2008-02-03 22:42:03 +00:00
|
|
|
{
|
2008-10-02 12:29:19 +00:00
|
|
|
/* Will start to destroy items to try to fit the next one */
|
|
|
|
RINGBUF_FLAG_RECYCLE=1
|
|
|
|
};
|
2008-02-03 22:42:03 +00:00
|
|
|
|
2008-10-02 12:29:19 +00:00
|
|
|
RINGBUFFER *ringbuf_init(void *memory, int size, int flags);
|
|
|
|
void ringbuf_clear(RINGBUFFER *rb);
|
2008-02-03 23:55:37 +00:00
|
|
|
void *ringbuf_allocate(RINGBUFFER *rb, int size);
|
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
|
|
|
|
2008-10-16 17:08:58 +00:00
|
|
|
int ringbuf_popfirst(RINGBUFFER *rb);
|
2008-10-02 12:29:19 +00:00
|
|
|
|
2008-02-04 00:13:34 +00:00
|
|
|
#endif
|