about summary refs log tree commit diff
path: root/src/engine/e_ringbuffer.h
blob: 6113c19b8d977958bf76932e403058b758da8b3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef _RINGBUFFER_H
#define _RINGBUFFER_H

typedef struct RINGBUFFER RINGBUFFER;

enum
{
	/* Will start to destroy items to try to fit the next one */
	RINGBUF_FLAG_RECYCLE=1
};
 
RINGBUFFER *ringbuf_init(void *memory, int size, int flags);
void ringbuf_clear(RINGBUFFER *rb);
void *ringbuf_allocate(RINGBUFFER *rb, int size);

void *ringbuf_prev(RINGBUFFER *rb, void *current);
void *ringbuf_next(RINGBUFFER *rb, void *current);
void *ringbuf_first(RINGBUFFER *rb);
void *ringbuf_last(RINGBUFFER *rb);

int ringbuf_popfirst(RINGBUFFER *rb);

#endif