master
Ondřej Hruška 2 years ago
parent 338a22cf62
commit 73e0d601db
  1. 6
      circbuf_deque/circbuf.c
  2. 1
      circbuf_deque/circbuf.h

@ -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;
} }

@ -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 */

Loading…
Cancel
Save