42-archive/nm-otool/libft2/srcs/lst/ft_lstnew.c
2017-10-07 17:49:14 +02:00

27 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/29 15:57:38 by jhalford #+# #+# */
/* Updated: 2017/03/21 15:43:51 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_list *ft_lstnew(void const *content, size_t content_size)
{
t_list *new;
if (!(new = (t_list *)ft_malloc(sizeof(*new))))
return (NULL);
new->next = NULL;
new->content_size = content_size;
new->content = ft_memalloc(content_size + 1);
if (content)
ft_memcpy(new->content, content, content_size);
return (new);
}