Browse Source

correct3

master
Elouan MARTINET 4 years ago
parent
commit
1fc27c74f3
  1. 8
      ex14/ft_list_sort.c

8
ex14/ft_list_sort.c

@ -6,7 +6,7 @@
/* By: emartine <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/08/17 16:27:18 by emartine #+# #+# */
/* Updated: 2017/08/17 17:19:42 by emartine ### ########.fr */
/* Updated: 2017/08/21 16:26:20 by emartine ### ########.fr */
/* */
/* ************************************************************************** */
@ -29,8 +29,8 @@ void ft_list_sort_alt(t_list *list, int (*cmp)(), int size)
if (cmp(previous->data, current->data) > 0)
{
t = previous->data;
previous->data = current->next->data;
current->next->data = t;
previous->data = current->data;
current->data = t;
}
previous = current;
current = current->next;
@ -44,7 +44,7 @@ void ft_list_sort(t_list **begin_list, int (*cmp)())
t_list *current;
int size;
if (!*begin_list || (*begin_list)->next)
if (!*begin_list || !(*begin_list)->next)
return ;
size = 0;
current = *begin_list;

Loading…
Cancel
Save