diff options
| author | Charles <sircharlesaze@gmail.com> | 2019-10-25 03:37:52 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2019-10-25 03:37:52 +0200 |
| commit | cade8c9ab269b0981725f002fea34fda035fb707 (patch) | |
| tree | 62654a3c7a5697d9cc963c101be23b33d9278fbf /ft_lstpop_front_bonus.c | |
| parent | b3e59abef6a141073e295b0354d8f28a66a15d0a (diff) | |
| download | libft-cade8c9ab269b0981725f002fea34fda035fb707.tar.gz libft-cade8c9ab269b0981725f002fea34fda035fb707.tar.bz2 libft-cade8c9ab269b0981725f002fea34fda035fb707.zip | |
Added strndup and lstpop_front
Diffstat (limited to 'ft_lstpop_front_bonus.c')
| -rw-r--r-- | ft_lstpop_front_bonus.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/ft_lstpop_front_bonus.c b/ft_lstpop_front_bonus.c new file mode 100644 index 0000000..f81315a --- /dev/null +++ b/ft_lstpop_front_bonus.c @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstpop_front_bonus.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/10/25 03:32:51 by cacharle #+# #+# */ +/* Updated: 2019/10/25 03:35:58 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include <stdlib.h> +#include "libft.h" + +void ft_lstpop_front(t_list **lst, void (*del)(void *)) +{ + t_list *tmp; + + if (lst == NULL || *lst == NULL) + return ; + tmp = (*lst)->next; + del((*lst)->content); + free(*lst); + *lst = tmp; +} |
