-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstnew.c
26 lines (23 loc) · 1.24 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bwebb <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/06/11 14:09:42 by bwebb #+# #+# */
/* Updated: 2019/06/11 19:10:20 by bwebb ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_list *ft_lstnew(void const *content, size_t content_size)
{
t_list *lsnew;
if (!(lsnew = (t_list*)malloc(sizeof(t_list))))
return (NULL);
lsnew->content = (content) ? ft_memcpy(ft_memalloc(content_size)\
, (void *)content, content_size) : NULL;
lsnew->content_size = (content == NULL) ? 0 : content_size;
lsnew->next = NULL;
return (lsnew);
}