summaryrefslogtreecommitdiff
path: root/src/shared/ring.h
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2014-07-09 20:20:46 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2014-07-11 16:43:53 +0200
commit1ca5fd003f5d3ffb32db581cb8d82d0721b5b12d (patch)
tree242fae381ff22bbd8c72fdfcea6b09d3e0d80317 /src/shared/ring.h
parent7df23077e45e55a6fc15eb99fe2ae439678e37e0 (diff)
shared: fix coding-style for ring-buffer implementation
We use "typedef struct Ring Ring" with camel-case for internal objects. So rename "struct ring" to "Ring".
Diffstat (limited to 'src/shared/ring.h')
-rw-r--r--src/shared/ring.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/shared/ring.h b/src/shared/ring.h
index 6b12530e31..1210aabdf6 100644
--- a/src/shared/ring.h
+++ b/src/shared/ring.h
@@ -27,7 +27,9 @@
#include <string.h>
#include <sys/uio.h>
-struct ring {
+typedef struct Ring Ring;
+
+struct Ring {
uint8_t *buf; /* buffer or NULL */
size_t size; /* actual size of @buf */
size_t start; /* start position of ring */
@@ -35,25 +37,25 @@ struct ring {
};
/* flush buffer so it is empty again */
-void ring_flush(struct ring *r);
+void ring_flush(Ring *r);
/* flush buffer, free allocated data and reset to initial state */
-void ring_clear(struct ring *r);
+void ring_clear(Ring *r);
/* get pointers to buffer data and their length */
-size_t ring_peek(struct ring *r, struct iovec *vec);
+size_t ring_peek(Ring *r, struct iovec *vec);
/* copy data into external linear buffer */
-size_t ring_copy(struct ring *r, void *buf, size_t size);
+size_t ring_copy(Ring *r, void *buf, size_t size);
/* push data to the end of the buffer */
-int ring_push(struct ring *r, const void *u8, size_t size);
+int ring_push(Ring *r, const void *u8, size_t size);
/* pull data from the front of the buffer */
-void ring_pull(struct ring *r, size_t size);
+void ring_pull(Ring *r, size_t size);
/* return size of occupied buffer in bytes */
-static inline size_t ring_get_size(struct ring *r)
+static inline size_t ring_get_size(Ring *r)
{
return r->used;
}