| 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 | 1992 | void my_delete_circle_list(node_t **begin) | |
| 21 | { | ||
| 22 | 1992 | node_t *backup = *begin; | |
| 23 | 1992 | node_t *tmp = NULL; | |
| 24 | 1992 | node_t *next = NULL; | |
| 25 | |||
| 26 | 2/2✓ Branch 0 taken 1617 times. ✓ Branch 1 taken 375 times. | 1992 | if (backup != NULL) | 
| 27 | 1617 | tmp = backup->next; | |
| 28 | 4/4✓ Branch 0 taken 308890 times. ✓ Branch 1 taken 889 times. ✓ Branch 2 taken 307787 times. ✓ Branch 3 taken 1103 times. | 309779 | while (tmp != backup && tmp != NULL) { | 
| 29 | 307787 | next = tmp->next; | |
| 30 | 3/4✓ Branch 0 taken 307787 times. ✗ Branch 1 not taken. ✓ Branch 2 taken 301637 times. ✓ Branch 3 taken 6150 times. | 307787 | if (tmp->data != NULL && tmp->type != UNKNOWN) | 
| 31 | 301637 | FREE(tmp->data); | |
| 32 | 307787 | FREE(tmp); | |
| 33 | 307787 | tmp = next; | |
| 34 | } | ||
| 35 | 2/2✓ Branch 0 taken 1617 times. ✓ Branch 1 taken 375 times. | 1992 | if (backup != NULL) { | 
| 36 | 3/4✓ Branch 0 taken 1617 times. ✗ Branch 1 not taken. ✓ Branch 2 taken 525 times. ✓ Branch 3 taken 1092 times. | 1617 | if (backup->data != NULL && backup->type != UNKNOWN) | 
| 37 | 525 | FREE(backup->data); | |
| 38 | 1617 | FREE(backup); | |
| 39 | } | ||
| 40 | 1992 | *begin = NULL; | |
| 41 | 1992 | } | |
| 42 |