mirror of
https://github.com/DavidGailleton/42-Push_Swap.git
synced 2026-01-27 08:41:58 +00:00
starting the bonus and modify the name folder headers -> includes
This commit is contained in:
32
bonus/utils/stack_remove.c
Normal file
32
bonus/utils/stack_remove.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* stack_remove.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/12/08 16:05:27 by dgaillet #+# #+# */
|
||||
/* Updated: 2025/12/12 11:39:02 by dgaillet ### ########lyon.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "push_swap.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
void stack_clear_all(t_stack *stack, t_stack *first)
|
||||
{
|
||||
if (!stack)
|
||||
return ;
|
||||
if (stack->next != first)
|
||||
stack_clear_all(stack->next, first);
|
||||
free(stack);
|
||||
}
|
||||
|
||||
void free_all(t_stacks *stacks)
|
||||
{
|
||||
if (stacks->a)
|
||||
stack_clear_all(stacks->a, stacks->a);
|
||||
if (stacks->b)
|
||||
stack_clear_all(stacks->b, stacks->b);
|
||||
free(stacks);
|
||||
}
|
||||
Reference in New Issue
Block a user