Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | ** EPITECH PROJECT, 2024 | ||
3 | ** my_delete_circle_list | ||
4 | ** File description: | ||
5 | ** Deletes a circular linked list | ||
6 | */ | ||
7 | /** | ||
8 | * @file my_delete_circle_list.c | ||
9 | * @brief The file containing the my_delete_circle_list function | ||
10 | * @author Nicolas TORO | ||
11 | */ | ||
12 | |||
13 | #include "mylist.h" | ||
14 | |||
15 | /** | ||
16 | * @brief Deletes a circular linked list | ||
17 | * @param begin The beginning of the list | ||
18 | * @return void | ||
19 | */ | ||
20 | 2122 | void my_delete_circle_list(node_t **begin) | |
21 | { | ||
22 | 2122 | node_t *backup = *begin; | |
23 | 2122 | node_t *tmp = NULL; | |
24 | 2122 | node_t *next = NULL; | |
25 | |||
26 |
2/2✓ Branch 0 taken 1748 times.
✓ Branch 1 taken 374 times.
|
2122 | if (backup != NULL) |
27 | 1748 | tmp = backup->next; | |
28 |
4/4✓ Branch 0 taken 377383 times.
✓ Branch 1 taken 918 times.
✓ Branch 2 taken 376179 times.
✓ Branch 3 taken 1204 times.
|
378301 | while (tmp != backup && tmp != NULL) { |
29 | 376179 | next = tmp->next; | |
30 |
3/4✓ Branch 0 taken 376179 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 374556 times.
✓ Branch 3 taken 1623 times.
|
376179 | if (tmp->data != NULL && tmp->type != UNKNOWN) |
31 | 374556 | FREE(tmp->data); | |
32 | 376179 | FREE(tmp); | |
33 | 376179 | tmp = next; | |
34 | } | ||
35 |
2/2✓ Branch 0 taken 1748 times.
✓ Branch 1 taken 374 times.
|
2122 | if (backup != NULL) { |
36 |
3/4✓ Branch 0 taken 1748 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 545 times.
✓ Branch 3 taken 1203 times.
|
1748 | if (backup->data != NULL && backup->type != UNKNOWN) |
37 | 545 | FREE(backup->data); | |
38 | 1748 | FREE(backup); | |
39 | } | ||
40 | 2122 | *begin = NULL; | |
41 | 2122 | } | |
42 |