DEBUG_PRINT

This commit is contained in:
Imbus 2024-07-15 21:50:59 +02:00
parent d6a3c95951
commit 6a4dc46b60

View file

@ -6,7 +6,6 @@
#include "ringbuf.h" #include "ringbuf.h"
#include <stdint.h> #include <stdint.h>
#include <stdio.h>
#ifdef DEBUG #ifdef DEBUG
#include <stdio.h> #include <stdio.h>
#define DEBUG_PRINT(fmt, ...) printf(fmt, __VA_ARGS__) #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 void
rb_debug_print(struct RingBuf *rb) rb_debug_print(struct RingBuf *rb)
{ {
printf("============\n"); DEBUG_PRINT("============%s\n", "");
printf("Count %lu\n", rb->count); DEBUG_PRINT("Count %lu\n", rb->count);
printf("Capacity: %ld\n", rb->capacity); DEBUG_PRINT("Capacity: %ld\n", rb->capacity);
printf("Left: %ld\n", rb->capacity - rb->count); DEBUG_PRINT("Left: %ld\n", rb->capacity - rb->count);
printf("Base addr:\t%p\n", rb->buffer); DEBUG_PRINT("Base addr:\t%p\n", rb->buffer);
printf("Read Head:\t%p (%ld:th position)\n", rb->read_head, DEBUG_PRINT("Read Head:\t%p (%ld:th position)\n", rb->read_head,
((rb->read_head) - (rb->buffer)) / rb->struct_size); ((rb->read_head) - (rb->buffer)) / rb->struct_size);
printf("Write Head:\t%p (%ld:th position)\n", rb->write_head, DEBUG_PRINT("Write Head:\t%p (%ld:th position)\n", rb->write_head,
((rb->write_head) - (rb->buffer)) / rb->struct_size); ((rb->write_head) - (rb->buffer)) / rb->struct_size);
printf("============\n"); DEBUG_PRINT("============%s\n", "");
} }