From 24dc23e78ca4b49d599093f7936ddcb9da818ab6 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Sat, 21 Dec 2013 23:48:52 +0100 Subject: rb: allow to remove data from a ring buffer we provide two new ways to remove data from a ring_buffer rb_remove(rb, n) or rb_get(rb, NULL, n) closes #2 --- rb.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'rb.h') diff --git a/rb.h b/rb.h index f66dba8..5b1e0e1 100644 --- a/rb.h +++ b/rb.h @@ -46,4 +46,13 @@ size_t rb_get(t_rb *rb, void *dest, size_t n); */ size_t rb_peek(const t_rb *ring_buffer, void *dest, size_t size); +/* + * remove a maximum of n bytes from the ring buffer pointed to by rb + * the functions returns the number of bytes actually removed + */ +static inline size_t rb_remove(t_rb *rb, size_t n) +{ + return rb_get(rb, NULL, n); +} + #endif /* RING_BUFFER_H */ -- cgit v1.2.3