Compare commits

..

2 commits

Author SHA1 Message Date
Imbus
06b949bed4 Remove redundant debug code/printing 2024-07-02 06:38:01 +02:00
Imbus
de2465de83 Check return in driver program 2024-07-02 06:37:58 +02:00
2 changed files with 3 additions and 15 deletions

View file

@ -16,7 +16,9 @@ main(void)
int arr[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int ok = WriteOk; // Assume we can write
ok = rb_push_many(&rb, arr, memcpy, 8);
if(rb_push_many(&rb, arr, memcpy, 8) != WriteOk) {
printf("Failed to write data to buffer...\n");
}
int d;
while(rb_pop_front(&rb, &d, memcpy) == ReadOk) {

View file

@ -23,20 +23,6 @@ rb_init(struct RingBuf *rb, rb_size_t capacity, ALLOC_T malloc_fn,
rb->count = 0;
rb->write_head = rb->buffer;
rb->read_head = rb->buffer;
DEBUG_PRINT("Reading from buffer at position %d\n",
rb->capacity * rb->struct_size);
// Read from buffer at max position to force a segfault if theres an issue
void *top = rb->buffer + (rb->capacity * rb->struct_size);
DEBUG_PRINT("Buffer top successfully read at virtual address: %p\n", &top);
DEBUG_PRINT(
"Initialized ring buffer. Capacit: %d, struct_size: %d, total: %d\n",
rb->capacity, rb->struct_size, rb->capacity * rb->struct_size);
DEBUG_PRINT("Size of RB: %lu\n", sizeof(struct RingBuf));
}
void