-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstnew_bonus.c
34 lines (31 loc) · 1.26 KB
/
ft_lstnew_bonus.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_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fulldemo <fulldemo@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/15 15:19:47 by fulldemo #+# #+# */
/* Updated: 2019/11/16 19:45:26 by fulldemo ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_list *ft_lstnew(void *content)
{
t_list *new;
if ((new = (t_list *)malloc(sizeof(t_list))) == NULL)
return (NULL);
if (content == NULL)
{
new->content = NULL;
new->next = NULL;
}
else
{
if ((new->content = (void *)malloc(sizeof(content))) == NULL)
return (NULL);
ft_memcpy(new->content, content, ft_strlen(content));
new->next = NULL;
}
return (new);
}