-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstnew.c
34 lines (31 loc) · 1.25 KB
/
ft_lstnew.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
33
34
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rmc-coma <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/12/03 11:10:54 by rmc-coma #+# #+# */
/* Updated: 2015/12/04 18:51:58 by rmc-coma ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_list *ft_lstnew(const void *content, size_t content_size)
{
t_list *lst;
lst = (t_list *)malloc(sizeof(t_list));
if (lst == NULL)
return (NULL);
if (content == NULL)
{
lst->content = NULL;
lst->content_size = 0;
}
else
{
lst->content = ft_memdup((void *)content, content_size);
lst->content_size = content_size;
}
lst->next = NULL;
return (lst);
}