plus de leaks yeaaah
This commit is contained in:
16
srcs/print.c
16
srcs/print.c
@@ -2,18 +2,15 @@
|
||||
#include "push_swap.h"
|
||||
|
||||
/*
|
||||
** this function is called at each action (pushes, swapes, rotates)
|
||||
** pointers to the stacks a and b are stored into two first element of list solution (because both lists a and b are not available from every functions, like sa() doesn't receive b in argument)
|
||||
** the function access the list after the two first elements to fill a new element with three things :
|
||||
** - the name of the action (sa, sp, rra, etc)
|
||||
** - the stack a
|
||||
** - the stack b
|
||||
** like this :
|
||||
** this function fill a new element on the chained list like this :
|
||||
** name!a: nb nb nb nb nb!b: nb nb nb
|
||||
** "!" are used to split, it will be turn into :
|
||||
**
|
||||
** it will later be printed like this ("!" is the char to split) :
|
||||
** name
|
||||
** a: nb nb nb nb nb
|
||||
** b: nb nb nb
|
||||
**
|
||||
** or only "name" if not flag -p
|
||||
*/
|
||||
void fill_solution(t_list *solution, char *sp)
|
||||
{
|
||||
@@ -55,6 +52,9 @@ void print_result(t_list *result, int flag)
|
||||
ft_printf(" %s\n", part[2]);
|
||||
}
|
||||
result = result->next;
|
||||
free(part[0]);
|
||||
free(part[1]);
|
||||
free(part[2]);
|
||||
free(part);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user