-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_swap_push.c
46 lines (38 loc) · 1.55 KB
/
ft_swap_push.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_swap_push.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lgasc <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/31 15:29:08 by lgasc #+# #+# */
/* Updated: 2024/02/27 11:13:19 by lgasc ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft/libft.h"
#include "stacks.h"
#ifdef TEST
# include "ft_printf/ft_printf_conversion.h"
#endif
__attribute__ ((nonnull))
void ft_swap_a(struct s_stacks *const stacks)
{
ft_putendl_fd("sa", 1);
ft_ilstswap(&stacks->primary, &stacks->primary->next);
}
void ft_push_to_a(struct s_stacks *const stacks)
{
t_inode *const node = stacks->secondary;
ft_putstr_fd("pa\n", 1);
stacks->secondary = node->next;
node->next = stacks->primary;
stacks->primary = node;
}
void ft_push_to_b(struct s_stacks *const stacks)
{
t_inode *const node = stacks->primary;
ft_putstr_fd("pb\n", 1);
stacks->primary = node->next;
node->next = stacks->secondary;
stacks->secondary = node;
}