/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_lst2new.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: tmaze +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/09/30 17:28:23 by tmaze #+# #+# */ /* Updated: 2018/09/30 17:54:12 by tmaze ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" t_list2 *ft_lst2new(void const *content, size_t content_size) { t_list2 *ret; if ((ret = (t_list2*)malloc(sizeof(t_list2))) != NULL) { if (!content) { ret->content = NULL; ret->content_size = 0; } else { if ((ret->content = malloc(content_size)) == NULL) { free(ret); return (0); } ft_memmove(ret->content, content, content_size); ret->content_size = content_size; } ret->next = NULL; ret->prev = NULL; } return (ret); }