Dernier correction tout fini (:
This commit is contained in:
parent
e517983764
commit
abbb8d13d4
10
push_swap.c
10
push_swap.c
|
@ -6,7 +6,7 @@
|
|||
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/11/23 16:48:12 by erey-bet #+# #+# */
|
||||
/* Updated: 2022/12/08 16:57:34 by erey-bet ### ########.fr */
|
||||
/* Updated: 2022/12/11 15:51:26 by erey-bet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -83,11 +83,11 @@ void push_swap_5(long *tab, int len)
|
|||
t_stack sb;
|
||||
|
||||
sa.list = get_index(tab, len);
|
||||
sa.len = len;
|
||||
sb.list = malloc(sizeof(long) * (len + 1));
|
||||
if (sb.list == NULL)
|
||||
if (sa.list == NULL)
|
||||
return ;
|
||||
sa.len = len;
|
||||
if (init_sb(&sb, len) == NULL)
|
||||
return ;
|
||||
sb.len = 0;
|
||||
while (sb.len != 2)
|
||||
{
|
||||
while (get_min(sa.list, sa.len) != 0)
|
||||
|
|
|
@ -44,6 +44,8 @@ int tab_malloc(int argc, char *argv[]);
|
|||
int put_error(void);
|
||||
char **set_only_space(char *argv[], int i);
|
||||
int if_there_is_double(long *tab, int y);
|
||||
void *init_sb(t_stack *sb, int len);
|
||||
|
||||
|
||||
// Parsing
|
||||
int parsing(int argc, char *argv[], long *tab);
|
||||
|
|
11
tools_2.c
11
tools_2.c
|
@ -6,7 +6,7 @@
|
|||
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/12/09 15:54:00 by erey-bet #+# #+# */
|
||||
/* Updated: 2022/12/09 15:54:03 by erey-bet ### ########.fr */
|
||||
/* Updated: 2022/12/11 15:51:37 by erey-bet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -48,3 +48,12 @@ int if_there_is_double(long *tab, int y)
|
|||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
void *init_sb(t_stack *sb, int len)
|
||||
{
|
||||
sb->list = malloc(sizeof(long) * (len + 1));
|
||||
if (sb->list == NULL)
|
||||
return (NULL);
|
||||
sb->len = 0;
|
||||
return (sb);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue