-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstdup.c
32 lines (29 loc) · 1.26 KB
/
ft_lstdup.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstdup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ylagtab <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/09 22:52:43 by ylagtab #+# #+# */
/* Updated: 2019/04/10 18:10:22 by ylagtab ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_list *ft_lstdup(t_list *lst_src)
{
t_list *head;
t_list *lst_dst;
if (lst_src == NULL)
return (NULL);
lst_dst = ft_lstnew(lst_src->content, lst_src->content_size);
head = lst_dst;
lst_src = lst_src->next;
while (lst_src)
{
lst_dst->next = ft_lstnew(lst_src->content, lst_src->content_size);
lst_dst = lst_dst->next;
lst_src = lst_src->next;
}
return (head);
}