with lst_pop propre

This commit is contained in:
ariard 2017-07-04 17:40:24 +02:00
parent 6fdb76b528
commit 91f79ea663
5 changed files with 29 additions and 0 deletions

View file

@ -104,6 +104,7 @@ lst/ft_lstnew.c\
lst/ft_lstnew_range.c\ lst/ft_lstnew_range.c\
lst/ft_lstsort.c\ lst/ft_lstsort.c\
lst/lst_insert_sort.c\ lst/lst_insert_sort.c\
lst/ft_lst_pop.c\
lst/pop.c\ lst/pop.c\
lst/push.c\ lst/push.c\
lst/top.c\ lst/top.c\
@ -168,6 +169,7 @@ str/ft_strcspn.c\
str/ft_strcut.c\ str/ft_strcut.c\
str/ft_strdel.c\ str/ft_strdel.c\
str/ft_strdup.c\ str/ft_strdup.c\
str/ft_strndup.c\
str/ft_strdupchr.c\ str/ft_strdupchr.c\
str/ft_strduptr.c\ str/ft_strduptr.c\
str/ft_strequ.c\ str/ft_strequ.c\

View file

@ -88,4 +88,6 @@ t_list *ft_lst_at(t_list *list, unsigned int nbr);
void lst_insert_sort(t_list **head, void lst_insert_sort(t_list **head,
int (cmp)()); int (cmp)());
t_list *ft_lst_pop(t_list **lst);
#endif #endif

View file

@ -72,4 +72,6 @@ size_t ft_strcspn(char *s, const char *delim);
char *ft_path_notdir(char *path); char *ft_path_notdir(char *path);
int ft_stris(char *str, int (*f)()); int ft_stris(char *str, int (*f)());
char *ft_strndup(const char *s1, size_t n);
#endif #endif

View file

@ -0,0 +1,11 @@
#include "libft.h"
t_list *ft_lst_pop(t_list **lst)
{
t_list *top;
top = *lst;
if (lst && *lst)
*lst = (*lst)->next;
return (top);
}

View file

@ -0,0 +1,12 @@
#include "libft.h"
char *ft_strndup(const char *s1, size_t n)
{
char *dup;
if (!(dup = ft_memalloc(n)))
return (NULL);
ft_strncpy(dup, s1, n);
return (dup);
}