-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_lstnew.c
More file actions
35 lines (32 loc) · 1.25 KB
/
ft_lstnew.c
File metadata and controls
35 lines (32 loc) · 1.25 KB
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: mmoufakk <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/10/24 19:50:47 by mmoufakk #+# #+# */
/* Updated: 2018/10/25 20:55:18 by mmoufakk ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_list *ft_lstnew(void const *content, size_t content_size)
{
t_list *dest;
size_t i;
i = 0;
if (!(dest = (t_list*)malloc(sizeof(t_list))))
return (NULL);
if (!content)
{
dest->content = NULL;
dest->content_size = 0;
}
else
{
dest->content = ft_strdup((const char *)content);
dest->content_size = content_size;
}
dest->next = NULL;
return (dest);
}