diff options
Diffstat (limited to 'src/ft_printf/list.c')
| -rw-r--r-- | src/ft_printf/list.c | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/src/ft_printf/list.c b/src/ft_printf/list.c deleted file mode 100644 index 99491f4..0000000 --- a/src/ft_printf/list.c +++ /dev/null @@ -1,67 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* list.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2019/10/29 00:14:50 by cacharle #+# #+# */ -/* Updated: 2019/11/05 23:45:42 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "ft_vasprintf.h" - -t_flist *list_new(t_pformat *content) -{ - t_flist *lst; - - if ((lst = (t_flist*)malloc(sizeof(t_flist))) == NULL) - return (NULL); - lst->content = content; - lst->next = NULL; - return (lst); -} - -void *list_destroy(t_flist **lst) -{ - if (lst == NULL) - return (NULL); - while (*lst != NULL) - list_pop_front(lst); - return (NULL); -} - -void list_push_front(t_flist **lst, t_flist *new) -{ - if (lst == NULL || new == NULL) - return ; - new->next = *lst; - *lst = new; -} - -void list_pop_front(t_flist **lst) -{ - t_flist *tmp; - - if (lst == NULL || *lst == NULL) - return ; - tmp = (*lst)->next; - free((*lst)->content); - free(*lst); - *lst = tmp; -} - -t_flist *list_reverse(t_flist *lst) -{ - t_flist *tmp; - - if (lst == NULL) - return (NULL); - if (lst->next == NULL) - return (lst); - tmp = list_reverse(lst->next); - lst->next->next = lst; - lst->next = NULL; - return (tmp); -} |
