This commit is contained in:
2023-01-12 23:50:54 +01:00
parent 338a22cf62
commit 73e0d601db
2 changed files with 4 additions and 3 deletions
+3 -3
View File
@@ -139,7 +139,7 @@ bool cbuf_peek(const CircBuf *cb, void *dest)
void * cbuf_ptr(const CircBuf *cb) void * cbuf_ptr(const CircBuf *cb)
{ {
if (cb == NULL || dest == NULL || cb->num_used == 0) { if (cb == NULL || cb->num_used == 0) {
return NULL; return NULL;
} }
@@ -163,7 +163,7 @@ bool cbuf_nth(const CircBuf *cb, circbuf_size_t num, void *dest)
void *cbuf_ptr_nth(const CircBuf *cb, circbuf_size_t num) void *cbuf_ptr_nth(const CircBuf *cb, circbuf_size_t num)
{ {
if (cb == NULL || dest == NULL || num > cb->num_used) { if (cb == NULL || num > cb->num_used) {
return NULL; return NULL;
} }
@@ -231,7 +231,7 @@ bool cbuf_peek_back(const CircBuf *cb, void *dest)
void* cbuf_ptr_back(const CircBuf *cb) void* cbuf_ptr_back(const CircBuf *cb)
{ {
if (cb == NULL || dest == NULL || cb->num_used == 0) { if (cb == NULL || cb->num_used == 0) {
return NULL; return NULL;
} }
+1
View File
@@ -20,6 +20,7 @@
// Enable to zero a freed slots after pop, useful for debugging // Enable to zero a freed slots after pop, useful for debugging
#define CIRCBUF_ZERO_FREE_SLOTS #define CIRCBUF_ZERO_FREE_SLOTS
// size_t can be replaced by a more suitable type for circbuf, e.g. uint8_t for tiny buffers
typedef uint32_t circbuf_size_t; typedef uint32_t circbuf_size_t;
/** Instance structure - public to allow static allocation, but consider the structure internal matter */ /** Instance structure - public to allow static allocation, but consider the structure internal matter */