From 6a4dc46b60ebffffb9a95fbc4d6034d38ce7136e Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Mon, 15 Jul 2024 21:50:59 +0200 Subject: [PATCH] DEBUG_PRINT --- ringbuf.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/ringbuf.c b/ringbuf.c index bb94a01..d73affe 100644 --- a/ringbuf.c +++ b/ringbuf.c @@ -6,7 +6,6 @@ #include "ringbuf.h" #include -#include #ifdef DEBUG #include #define DEBUG_PRINT(fmt, ...) printf(fmt, __VA_ARGS__) @@ -121,16 +120,16 @@ rb_pop_front(struct RingBuf *rb, void *item, MEMCPY_T memcpy_fn) void rb_debug_print(struct RingBuf *rb) { - printf("============\n"); - printf("Count %lu\n", rb->count); - printf("Capacity: %ld\n", rb->capacity); - printf("Left: %ld\n", rb->capacity - rb->count); - printf("Base addr:\t%p\n", rb->buffer); + DEBUG_PRINT("============%s\n", ""); + DEBUG_PRINT("Count %lu\n", rb->count); + DEBUG_PRINT("Capacity: %ld\n", rb->capacity); + DEBUG_PRINT("Left: %ld\n", rb->capacity - rb->count); + DEBUG_PRINT("Base addr:\t%p\n", rb->buffer); - printf("Read Head:\t%p (%ld:th position)\n", rb->read_head, - ((rb->read_head) - (rb->buffer)) / rb->struct_size); - printf("Write Head:\t%p (%ld:th position)\n", rb->write_head, - ((rb->write_head) - (rb->buffer)) / rb->struct_size); + DEBUG_PRINT("Read Head:\t%p (%ld:th position)\n", rb->read_head, + ((rb->read_head) - (rb->buffer)) / rb->struct_size); + DEBUG_PRINT("Write Head:\t%p (%ld:th position)\n", rb->write_head, + ((rb->write_head) - (rb->buffer)) / rb->struct_size); - printf("============\n"); + DEBUG_PRINT("============%s\n", ""); }