diff options
| author | nass1pro <nass1pro@gmail.com> | 2020-06-12 13:52:58 +0200 |
|---|---|---|
| committer | nass1pro <nass1pro@gmail.com> | 2020-06-13 11:45:50 +0200 |
| commit | d971bd8d16608f316396aba7a579d0b1f1af5aeb (patch) | |
| tree | 98ec558582ed20a120e13b4a376fd206fb620da0 /test_mini/libft/src/lst/ft_lstsort.c | |
| parent | 3136f59540a8dd29e2f096be5a8943e2ddd28431 (diff) | |
| download | minishell-d971bd8d16608f316396aba7a579d0b1f1af5aeb.tar.gz minishell-d971bd8d16608f316396aba7a579d0b1f1af5aeb.tar.bz2 minishell-d971bd8d16608f316396aba7a579d0b1f1af5aeb.zip | |
Added e_token enum
Diffstat (limited to 'test_mini/libft/src/lst/ft_lstsort.c')
| -rw-r--r-- | test_mini/libft/src/lst/ft_lstsort.c | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/test_mini/libft/src/lst/ft_lstsort.c b/test_mini/libft/src/lst/ft_lstsort.c deleted file mode 100644 index 9945a0f..0000000 --- a/test_mini/libft/src/lst/ft_lstsort.c +++ /dev/null @@ -1,46 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_lstsort.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/02/10 01:53:55 by cacharle #+# #+# */ -/* Updated: 2020/02/16 02:18:05 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft_lst.h" - -/* -** \brief Sort list -** \param cmp Comparison function, <0 if less, 0 if equal, >0 if greater -** \note Use merge sort algorithm -*/ - -void ft_lstsort(t_ftlst **begin_list, t_ftcompar_func cmp) -{ - t_ftlst *fast; - t_ftlst *slow; - t_ftlst *middle; - - if (begin_list == NULL || *begin_list == NULL - || (*begin_list)->next == NULL) - return ; - fast = (*begin_list)->next; - slow = *begin_list; - while (fast != NULL) - { - fast = fast->next; - if (fast != NULL) - { - fast = fast->next; - slow = slow->next; - } - } - middle = slow->next; - slow->next = NULL; - ft_lstsort(begin_list, cmp); - ft_lstsort(&middle, cmp); - *begin_list = ft_lstsorted_merge(*begin_list, middle, cmp); -} |
