-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstput_orderly.c
25 lines (22 loc) · 1.15 KB
/
ft_lstput_orderly.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstput_orderly.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ariahi <ariahi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/08/08 17:46:13 by ariahi #+# #+# */
/* Updated: 2022/12/28 08:53:39 by ariahi ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_list *lst_put_orderly(t_list **lst, char *d_name)
{
t_list *new;
char *dup;
dup = ft_strdup(d_name);
new = ft_lstnew(dup);
if (!new || !dup)
return (free(dup), free(new), ft_lstclear(lst, free), NULL);
return (lst_put_orderly_sorted_2(lst, new), new);
}