| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | ** EPITECH PROJECT, 2023 | ||
| 3 | ** my_merge_list | ||
| 4 | ** File description: | ||
| 5 | ** Merges two linked lists | ||
| 6 | */ | ||
| 7 | /** | ||
| 8 | * @file my_merge_list.c | ||
| 9 | * @brief The file containing the my_merge_list function | ||
| 10 | * @author Nicolas TORO | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include "mylist.h" | ||
| 14 | |||
| 15 | 2 | void my_merge_list(node_t **begin1, node_t *begin2, int (*cmp)()) | |
| 16 | { | ||
| 17 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
|
2 | if (*begin1 == NULL) { |
| 18 | 1 | *begin1 = begin2; | |
| 19 | 1 | return; | |
| 20 | } | ||
| 21 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 times.
|
4 | for (node_t *tmp = begin2; tmp != NULL; tmp = tmp->next) { |
| 22 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 2 taken 2 times.
|
3 | if (my_find_node(*begin1, tmp->data, cmp) == NULL) |
| 23 | 1 | my_push_back(begin1, tmp->data, tmp->type); | |
| 24 | } | ||
| 25 | } | ||
| 26 |