summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-07-25 20:09:54 +0200
committerRichard Braun <rbraun@sceen.net>2017-07-25 20:09:54 +0200
commit56fd1f5d9aabdbae8e694e9268875268a2811740 (patch)
treeffd2f1b0cda190c54399aedb02073c3e3e0799d7
parent0f214095fecca1a35df76619cb381c6793e0fdcd (diff)
cbuf: make cbuf_popb accept an untyped pointer
-rw-r--r--cbuf.c7
-rw-r--r--cbuf.h2
2 files changed, 6 insertions, 3 deletions
diff --git a/cbuf.c b/cbuf.c
index 36fb557..87797dc 100644
--- a/cbuf.c
+++ b/cbuf.c
@@ -115,13 +115,16 @@ cbuf_pushb(struct cbuf *cbuf, uint8_t byte, bool erase)
}
int
-cbuf_popb(struct cbuf *cbuf, uint8_t *bytep)
+cbuf_popb(struct cbuf *cbuf, void *bytep)
{
+ uint8_t *ptr;
+
if (cbuf_size(cbuf) == 0) {
return ERROR_AGAIN;
}
- *bytep = cbuf->buf[cbuf_index(cbuf, cbuf->start)];
+ ptr = bytep;
+ *ptr = cbuf->buf[cbuf_index(cbuf, cbuf->start)];
cbuf->start++;
return 0;
}
diff --git a/cbuf.h b/cbuf.h
index 6908d32..2220e35 100644
--- a/cbuf.h
+++ b/cbuf.h
@@ -126,7 +126,7 @@ int cbuf_pushb(struct cbuf *cbuf, uint8_t byte, bool erase);
*
* If the buffer is empty, ERROR_AGAIN is returned.
*/
-int cbuf_popb(struct cbuf *cbuf, uint8_t *bytep);
+int cbuf_popb(struct cbuf *cbuf, void *bytep);
/*
* Write into a circular buffer at a specific location.