diff --git a/lab01/zad1/src/main.c b/lab01/zad1/src/main.c index 8bea2c3..a139339 100644 --- a/lab01/zad1/src/main.c +++ b/lab01/zad1/src/main.c @@ -20,15 +20,14 @@ void test_queue(size_t size) { } for (size_t i = 0; i < 50; ++i) { - void *val_ptr = queue_read(q); - if (val_ptr == NULL) { + int64_t *val = (int64_t*)queue_read(q); + if (val == NULL) { printf("%zu: queue is empty!\n", i); break; } - int64_t val = *(int64_t*)val_ptr; - printf("%zu: read %ld from queue\n", i, val); - free(val_ptr); + printf("%zu: read %ld from queue\n", i, *val); + free(val); } queue_free(q); @@ -48,15 +47,14 @@ void test_stack(size_t size) { } for (size_t i = 0; i < 50; ++i) { - void *val_ptr = stack_pop(s); - if (val_ptr == NULL) { + int64_t *val = (int64_t*)stack_pop(s); + if (val == NULL) { printf("%zu: stack is empty!\n", i); break; } - int64_t val = *(int64_t*)val_ptr; - printf("%zu: popped %ld from stack\n", i, val); - free(val_ptr); + printf("%zu: popped %ld from stack\n", i, *val); + free(val); } stack_free(s);