Line |
Branch |
Exec |
Source |
1 |
|
|
/* |
2 |
|
|
** EPITECH PROJECT, 2023 |
3 |
|
|
** my_merge_list |
4 |
|
|
** File description: |
5 |
|
|
** Merges two linked lists |
6 |
|
|
*/ |
7 |
|
|
|
8 |
|
|
#include "mylist.h" |
9 |
|
|
|
10 |
|
✗ |
void my_merge_list(linked_list_t **begin1, linked_list_t *begin2, int (*cmp)()) |
11 |
|
|
{ |
12 |
|
✗ |
if (*begin1 == NULL) { |
13 |
|
✗ |
*begin1 = begin2; |
14 |
|
✗ |
return; |
15 |
|
|
} |
16 |
|
✗ |
for (linked_list_t *tmp = begin2; tmp != NULL; tmp = tmp->next) { |
17 |
|
✗ |
if (my_find_node(*begin1, tmp->data, cmp) == NULL) |
18 |
|
✗ |
my_push_back(begin1, tmp->data, tmp->type); |
19 |
|
|
} |
20 |
|
|
} |
21 |
|
|
|