summaryrefslogtreecommitdiffstats
path: root/lf_ringbuffer.c
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2010-01-12 12:58:49 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2010-01-12 12:58:49 +0100
commit1b393afeafa57a1a9baf72834b4f75388361931e (patch)
tree9ddf7cec7c650ca7fe9428ba38604961a61d279d /lf_ringbuffer.c
parented364de0e13fcb70d890ffa3763e7c7ec5a5797b (diff)
downloadlock_free-1b393afeafa57a1a9baf72834b4f75388361931e.zip
lock_free-1b393afeafa57a1a9baf72834b4f75388361931e.tar.gz
rename struct ring_buffer into ringbuffer
Diffstat (limited to 'lf_ringbuffer.c')
-rw-r--r--lf_ringbuffer.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/lf_ringbuffer.c b/lf_ringbuffer.c
index 99b8766..facf055 100644
--- a/lf_ringbuffer.c
+++ b/lf_ringbuffer.c
@@ -63,13 +63,13 @@
* Thus the maximum size of the buffer is 0xffff-1 = 65534 elements
*/
-/* initialize an empty lf_ring_buffer struct */
-lf_ring_buffer_t* lf_ring_buffer_create( size_t n_buf ) {
+/* initialize an empty lf_ringbuffer struct */
+lf_ringbuffer_t* lf_ringbuffer_create( size_t n_buf ) {
if(n_buf>=USHORTMAX) {
return NULL;
}
- /* alloc ring_buffer struct */
- lf_ring_buffer_t *r = malloc(sizeof(lf_ring_buffer_t));
+ /* alloc ringbuffer struct */
+ lf_ringbuffer_t *r = malloc(sizeof(lf_ringbuffer_t));
if(r==NULL) return NULL;
/* alloc buffer */
r->buffer = malloc(LFRB_BUFFER_SIZE*n_buf);
@@ -83,17 +83,17 @@ lf_ring_buffer_t* lf_ring_buffer_create( size_t n_buf ) {
return r;
}
-/* destroy an lf_ring_buffer strcture */
-void lf_ring_buffer_destroy( lf_ring_buffer_t *r ) {
+/* destroy an lf_ringbuffer strcture */
+void lf_ringbuffer_destroy( lf_ringbuffer_t *r ) {
free(r->buffer);
free(r);
}
/* return 1 if is empty */
-int lf_ring_buffer_empty( lf_ring_buffer_t *r ) { return (r->indexes>>16)==USHORTMAX; }
+int lf_ringbuffer_empty( lf_ringbuffer_t *r ) { return (r->indexes>>16)==USHORTMAX; }
/* write data into the ring buffer */
-int lf_ring_buffer_write( lf_ring_buffer_t *r, void *data, int flags ) {
+int lf_ringbuffer_write( lf_ringbuffer_t *r, void *data, int flags ) {
unsigned int current, next;
unsigned int write_to, read_from;
struct timespec backoff;
@@ -139,7 +139,7 @@ int lf_ring_buffer_write( lf_ring_buffer_t *r, void *data, int flags ) {
}
/* read data from the ring buffer */
-int lf_ring_buffer_read( lf_ring_buffer_t *r, void *data, int flags ) {
+int lf_ringbuffer_read( lf_ringbuffer_t *r, void *data, int flags ) {
unsigned int current, next;
unsigned int write_to, read_from, tmp;
struct timespec backoff;