42-archive/42sh/srcs/glob/ld/ft_ld_pushback.c
2017-01-26 19:24:00 +01:00

30 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ld_pushback.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/16 15:59:38 by wescande #+# #+# */
/* Updated: 2017/01/05 14:17:40 by wescande ### ########.fr */
/* */
/* ************************************************************************** */
#include "glob.h"
void ft_ld_pushback(t_ld **alst, void *content)
{
t_ld *new;
t_ld *back;
if (!alst || !*alst)
return (ft_ld_new(alst, content));
if ((new = (t_ld *)malloc(sizeof(t_ld))))
{
back = ft_ld_back(*alst);
new->prev = back;
new->next = NULL;
new->content = content;
back->next = new;
}
}