-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstnew.c
35 lines (32 loc) · 1.31 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
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: thifranc <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/03/04 09:53:59 by thifranc #+# #+# */
/* Updated: 2016/04/15 18:46:44 by thifranc ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_lol *ft_lstnew(void const *content, size_t content_size)
{
t_lol *new;
if (!(new = (t_lol*)malloc(sizeof(t_lol))))
return (NULL);
if (content == 0)
{
new->content = NULL;
new->content_size = 0;
}
else
{
if (!(new->content = (void*)malloc(sizeof(content))))
return (NULL);
new->content = ft_memcpy(new->content, content, content_size);
new->content_size = content_size;
}
new->next = NULL;
return (new);
}