From 66900228ee87af3d0b9e0bb0871420d938e3b3c5 Mon Sep 17 00:00:00 2001 From: Jack Halford Date: Fri, 16 Sep 2016 03:10:41 +0200 Subject: [PATCH] ft_lstpop --- libftasm/ft_lstpop.c | 11 +++++++++++ libftasm/libft.h | 1 + 2 files changed, 12 insertions(+) create mode 100644 libftasm/ft_lstpop.c diff --git a/libftasm/ft_lstpop.c b/libftasm/ft_lstpop.c new file mode 100644 index 00000000..7a7831ba --- /dev/null +++ b/libftasm/ft_lstpop.c @@ -0,0 +1,11 @@ +#include "libft.h" + +t_list *ft_lstpop(t_list **lst) +{ + t_list *top; + + top = *lst; + if (*lst) + *lst = (*lst)->next; + return (top); +} diff --git a/libftasm/libft.h b/libftasm/libft.h index 3836b675..0aa51a02 100644 --- a/libftasm/libft.h +++ b/libftasm/libft.h @@ -96,6 +96,7 @@ void ft_lst_cfree(void *ptr, size_t size); t_list *ft_lst_filter(t_list *lst, void const *data_ref, t_list *(*f)(t_list *elem, void const *)); t_list *ft_lst_removeif(t_list **alst, void *data_ref, int (*cmp)()); t_list *ft_lst_find(t_list *begin_list, void *data_ref, int (*cmp)()); +t_list *ft_lstpop(t_list **lst); int ft_diff(void *a, void *b); t_list *ft_id(t_list *a);