modified: diffout.py
[GalaxyCodeBases.git] / c_cpp / lib / uthash / src / ringbuf.h
blobd863cb1378092c8642a5a8863f27428fcaa6024f
1 #ifndef _RINGBUF_H_
2 #define _RINGBUF_H_
3 #include <stdio.h>
4 #include <string.h>
5 #include <stdlib.h>
6 #include <assert.h>
8 /* simple ring buffer */
10 typedef struct _ringbuf {
11 size_t n; /* allocd size */
12 size_t u; /* used space */
13 size_t i; /* input pos */
14 size_t o; /* output pos */
15 char d[]; /* C99 flexible array member */
16 } ringbuf;
18 ringbuf *ringbuf_new(size_t sz);
19 int ringbuf_put(ringbuf *r, const void *data, size_t len);
20 size_t ringbuf_get_pending_size(ringbuf *r);
21 size_t ringbuf_get_next_chunk(ringbuf *r, char **data);
22 void ringbuf_mark_consumed(ringbuf *r, size_t len);
23 void ringbuf_free(ringbuf *r);
24 void ringbuf_clear(ringbuf *r);
26 #endif /* _RINGBUF_H_ */