ft_lstnew.c 1.2 KB

1234567891011121314151617181920212223242526272829
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* ft_lstnew.c :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: mazimi <mazimi@student.42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2014/12/09 15:18:05 by mazimi #+# #+# */
  9. /* Updated: 2015/05/08 15:51:53 by mazimi ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "../libft.h"
  13. t_list *ft_lstnew(void const *content, size_t content_size)
  14. {
  15. t_list *list;
  16. list = (t_list *)malloc(sizeof(t_list));
  17. if (list == NULL)
  18. return (NULL);
  19. if (content != NULL)
  20. {
  21. list->content = (void*)content;
  22. list->content_size = content_size;
  23. }
  24. list->next = NULL;
  25. return (list);
  26. }