Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | ** EPITECH PROJECT, 2023 | ||
3 | ** delete_list | ||
4 | ** File description: | ||
5 | ** Deletes a linked list | ||
6 | */ | ||
7 | /** | ||
8 | * @file my_delete_list.c | ||
9 | * @brief The file containing the my_delete_list function | ||
10 | * @author Nicolas TORO | ||
11 | */ | ||
12 | |||
13 | #include "mylist.h" | ||
14 | |||
15 | 6 | void my_delete_list(node_t **begin) | |
16 | { | ||
17 | 6 | node_t *tmp = *begin; | |
18 | 6 | node_t *next = NULL; | |
19 | |||
20 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 6 times.
|
11 | while (tmp != NULL) { |
21 | 5 | next = tmp->next; | |
22 |
3/6✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | if (tmp->data && tmp->data != NULL && tmp->type != UNKNOWN) |
23 | 5 | FREE(tmp->data); | |
24 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (tmp) |
25 | 5 | FREE(tmp); | |
26 | 5 | tmp = next; | |
27 | } | ||
28 | 6 | *begin = NULL; | |
29 | 6 | } | |
30 |