Typedef for free function signature

This commit is contained in:
Imbus 2024-07-02 06:32:22 +02:00
parent eb4b11dda7
commit ea100383d7
2 changed files with 5 additions and 2 deletions

View file

@ -40,9 +40,9 @@ rb_init(struct RingBuf *rb, rb_size_t capacity, ALLOC_T malloc_fn,
}
void
rb_destroy(struct RingBuf *rb, void(free)())
rb_destroy(struct RingBuf *rb, FREE_T free_fn)
{
free(rb->buffer);
free_fn(rb->buffer);
}
void

View file

@ -12,6 +12,9 @@ typedef void *(*ALLOC_T)(rb_size_t);
/** Signature of memcpy */
typedef void *(*MEMCPY_T)(void *, const void *, rb_size_t);
/** Signature of free */
typedef void (*FREE_T)(void *);
/**
* @brief Ring buffer, also known as circular buffer.
*/