comparison th_util.h @ 276:1807059fb8f2

Move ringbuffer implementation.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 09 Jun 2011 11:37:34 +0300
parents 578730eebe07
children 21528fe535fb
comparison
equal deleted inserted replaced
275:66b90d71548b 276:1807059fb8f2
109 109
110 qlist_t * th_llist_find(qlist_t *list, const void *data); 110 qlist_t * th_llist_find(qlist_t *list, const void *data);
111 qlist_t * th_llist_find_func(qlist_t *list, const void *userdata, int (compare)(const void *, const void *)); 111 qlist_t * th_llist_find_func(qlist_t *list, const void *userdata, int (compare)(const void *, const void *));
112 112
113 113
114 /* Ringbuffer implementation
115 */
116 typedef struct {
117 void **data;
118 int n, size;
119 void (*deallocator)(void *);
120 } qringbuf_t;
121
122 qringbuf_t * th_ringbuf_new(const size_t size, void (*mdeallocator)(void *));
123 BOOL th_ringbuf_grow(qringbuf_t *buf, const size_t n);
124 void th_ringbuf_free(qringbuf_t *buf);
125 void th_ringbuf_add(qringbuf_t *buf, void *ptr);
126
127
114 #ifdef __cplusplus 128 #ifdef __cplusplus
115 } 129 }
116 #endif 130 #endif
117 #endif /* _TH_UTIL_H */ 131 #endif /* _TH_UTIL_H */