rt/libft/ft_lst_pushback.c

29 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lst_pushback.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: scebula <scebula@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/11/30 03:51:59 by scebula #+# #+# */
/* Updated: 2015/11/30 03:57:41 by scebula ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lst_pushback(t_list **begin_list, void *content, size_t content_size)
{
t_list *list;
list = *begin_list;
if (list)
{
while (list->next)
list = list->next;
list->next = ft_lstnew(content, content_size);
}
else
*begin_list = ft_lstnew(content, content_size);
}