better casting
This commit is contained in:
parent
2e62adfa57
commit
f23d8a1fb4
1 changed files with 8 additions and 10 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue