lazy week-end stuff B)
started conversion of functions to data structure system still WIP added first iteration of int parser does not check for int overflow
This commit is contained in:
@@ -6,17 +6,27 @@
|
||||
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/02/21 14:06:40 by tmaze #+# #+# */
|
||||
/* Updated: 2019/02/21 15:19:00 by tmaze ### ########.fr */
|
||||
/* Updated: 2019/02/23 15:24:12 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "push_swap.h"
|
||||
|
||||
void ps_swap(t_stack **s)
|
||||
void ps_swap(t_psdata *data, char c)
|
||||
{
|
||||
int tmp;
|
||||
t_stack *s;
|
||||
size_t size;
|
||||
int tmp;
|
||||
|
||||
if (*s != NULL && ps_stksize(*s) >= 2)
|
||||
if (c == 'a')
|
||||
s = data->a;
|
||||
if (c == 'a')
|
||||
size = data->size_a;
|
||||
else if (c == 'b')
|
||||
s = data->b;
|
||||
if (c == 'b')
|
||||
size = data->size_b;
|
||||
if (*s != NULL && size >= 2)
|
||||
{
|
||||
tmp = (*s)->nb;
|
||||
(*s)->nb = (*s)->next->nb;
|
||||
@@ -24,8 +34,8 @@ void ps_swap(t_stack **s)
|
||||
}
|
||||
}
|
||||
|
||||
void ps_sswap(t_stack **a, t_stack **b)
|
||||
void ps_sswap(t_psdata *data)
|
||||
{
|
||||
ps_swap(a);
|
||||
ps_swap(b);
|
||||
ps_swap(data, 'a');
|
||||
ps_swap(data, 'b');
|
||||
}
|
||||
|
Reference in New Issue
Block a user