/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_lstnew.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: bchanot +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/12/05 13:29:31 by bchanot #+# #+# */ /* Updated: 2018/04/17 11:50:02 by bchanot ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" t_slist *ft_lstnew(void *content, size_t content_size) { t_slist *list; if (!(list = (t_slist *)ft_memalloc(sizeof(*list)))) return (NULL); if (content && content_size) { if ((list->content = ft_memalloc(content_size))) ft_memcpy(list->content, content, content_size); else return (NULL); list->content_size = content_size; } else { list->content = NULL; list->content_size = 0; } list->next = NULL; return (list); }