mirror of
https://github.com/DavidGailleton/42-Push_Swap.git
synced 2026-01-27 00:41:57 +00:00
delete print stacks and looking for the secure malloc if there is a malloc not secure
This commit is contained in:
2
Makefile
2
Makefile
@@ -37,7 +37,7 @@ PARSING = ft_atoi.c parsing.c ft_strncmp.c ft_split.c ft_strlen.c ft_substr.c ch
|
|||||||
|
|
||||||
CHECKER_FILES = check_error.c verif_flag.c verif_is_digit.c verif_overflow.c verif_double.c
|
CHECKER_FILES = check_error.c verif_flag.c verif_is_digit.c verif_overflow.c verif_double.c
|
||||||
|
|
||||||
STACK_UTILS = push.c rev_rotate.c rotate.c stack_add.c stack_remove.c stacks_len.c swap.c print_stacks.c
|
STACK_UTILS = push.c rev_rotate.c rotate.c stack_add.c stack_remove.c stacks_len.c swap.c
|
||||||
|
|
||||||
MEDIUM_ALGO = utils_medium.c utils_struct_tab.c utils_medium_two.c sort_utils.c sort_utils_two.c medium_algo.c
|
MEDIUM_ALGO = utils_medium.c utils_struct_tab.c utils_medium_two.c sort_utils.c sort_utils_two.c medium_algo.c
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ void medium(t_stacks *stacks)
|
|||||||
{
|
{
|
||||||
range = range_bucket(stacks->a);
|
range = range_bucket(stacks->a);
|
||||||
buckets = get_tabs(stacks->a, range);
|
buckets = get_tabs(stacks->a, range);
|
||||||
|
if (!buckets)
|
||||||
|
return ;
|
||||||
bucket_algo(stacks, buckets, range);
|
bucket_algo(stacks, buckets, range);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ typedef struct s_stacks
|
|||||||
unsigned int ss;
|
unsigned int ss;
|
||||||
} t_stacks;
|
} t_stacks;
|
||||||
|
|
||||||
/* PRINT STACK FUNCTION*/
|
|
||||||
void print_stacks(t_stacks *stacks, int len, t_stack *a, t_stack *b);
|
|
||||||
/*STACK_FUNCTIONS*/
|
/*STACK_FUNCTIONS*/
|
||||||
void pa(t_stacks *stacks);
|
void pa(t_stacks *stacks);
|
||||||
void pb(t_stacks *stacks);
|
void pb(t_stacks *stacks);
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* ::: :::::::: */
|
|
||||||
/* print_stacks.c :+: :+: :+: */
|
|
||||||
/* +:+ +:+ +:+ */
|
|
||||||
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
|
|
||||||
/* +#+#+#+#+#+ +#+ */
|
|
||||||
/* Created: 2025/12/09 13:10:00 by dgaillet #+# #+# */
|
|
||||||
/* Updated: 2025/12/09 13:36:03 by dgaillet ### ########lyon.fr */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "push_swap.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
void print_stacks(t_stacks *stacks, int len, t_stack *a, t_stack *b)
|
|
||||||
{
|
|
||||||
int a_len;
|
|
||||||
int b_len;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
a_len = stack_a_len(stacks);
|
|
||||||
b_len = stack_b_len(stacks);
|
|
||||||
while (i < len)
|
|
||||||
{
|
|
||||||
if (a_len >= len - i)
|
|
||||||
{
|
|
||||||
printf("%d", a->value);
|
|
||||||
a = a->next;
|
|
||||||
}
|
|
||||||
printf("\t");
|
|
||||||
if (b_len >= len - i)
|
|
||||||
{
|
|
||||||
printf("%d", b->value);
|
|
||||||
b = b->next;
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
printf("_\t_\nA\tB\n\n");
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user