summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-06-18 14:55:10 +0200
committerRichard Braun <rbraun@sceen.net>2017-06-18 14:55:10 +0200
commit8830ffdeb4decb4196bedd5f90a5a4c2ee46001e (patch)
treeac3247055e17732d14e4642f1bcedbbb8031af80
parent50d58f6626a27029dc45e24a309f2b5e6cf75084 (diff)
cbuf: use void pointers with cbuf_read and cbuf_write
-rw-r--r--cbuf.c4
-rw-r--r--cbuf.h6
2 files changed, 5 insertions, 5 deletions
diff --git a/cbuf.c b/cbuf.c
index 3e6d953..1930ac7 100644
--- a/cbuf.c
+++ b/cbuf.c
@@ -84,7 +84,7 @@ cbuf_pop(struct cbuf *cbuf, char *bytep)
}
int
-cbuf_write(struct cbuf *cbuf, size_t index, const char *buf, size_t size)
+cbuf_write(struct cbuf *cbuf, size_t index, const void *buf, size_t size)
{
char *start, *end, *buf_end;
size_t new_end, skip;
@@ -124,7 +124,7 @@ cbuf_write(struct cbuf *cbuf, size_t index, const char *buf, size_t size)
}
int
-cbuf_read(const struct cbuf *cbuf, size_t index, char *buf, size_t *sizep)
+cbuf_read(const struct cbuf *cbuf, size_t index, void *buf, size_t *sizep)
{
const char *start, *end, *buf_end;
size_t size;
diff --git a/cbuf.h b/cbuf.h
index 4bd31f6..441473e 100644
--- a/cbuf.h
+++ b/cbuf.h
@@ -110,17 +110,17 @@ int cbuf_pop(struct cbuf *cbuf, char *bytep);
* appropriate. If the buffer is full when extending its end, the oldest
* bytes are overwritten and the start index is updated accordingly.
*/
-int cbuf_write(struct cbuf *cbuf, size_t index, const char *buf, size_t size);
+int cbuf_write(struct cbuf *cbuf, size_t index, const void *buf, size_t size);
/*
* Read from a circular buffer at a specific location.
*
* If the given index is outside buffer boundaries, ERR_INVAL is returned.
- * Otherwise at most *sizep bytes are copied into the given character buffer,
+ * Otherwise at most *sizep bytes are copied into the given byte buffer,
* and *sizep is updated to the number of bytes actually copied.
*
* The circular buffer isn't changed by this operation.
*/
-int cbuf_read(const struct cbuf *cbuf, size_t index, char *buf, size_t *sizep);
+int cbuf_read(const struct cbuf *cbuf, size_t index, void *buf, size_t *sizep);
#endif /* _CBUF_H */