libds

a collection of simple data structures
Log | Files | Refs | LICENSE

commit 120ce9548aa72e7166ccf02d8f5469e2ce23db9e
parent cc8d46aeba01c317411ed206cbc0de20db684789
Author: sin <sin@2f30.org>
Date:   Tue,  6 May 2014 14:36:01 +0100

Add fifo_size()

Diffstat:
Mds.h | 1+
Mfifo.c | 6++++++
2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/ds.h b/ds.h @@ -8,6 +8,7 @@ struct fifo *fifo_init(size_t); void fifo_free(struct fifo *); int fifo_add(struct fifo *, const void *, size_t); int fifo_remove(struct fifo *, void *, size_t); +size_t fifo_size(struct fifo *); /* stack.c */ struct stack *stack_init(void); diff --git a/fifo.c b/fifo.c @@ -68,3 +68,9 @@ fifo_remove(struct fifo *fifo, void *buf, size_t sz) fifo->sz -= sz; return 0; } + +size_t +fifo_size(struct fifo *fifo) +{ + return fifo->sz; +}