fixe reducer error non null
This commit is contained in:
@@ -81,6 +81,13 @@ static void terms_fill_null(s_term *terms, size_t terms_count_prediction)
|
||||
}
|
||||
}
|
||||
|
||||
static void polynom_fill_null(s_polynom *polynom)
|
||||
{
|
||||
polynom->a = 0.0;
|
||||
polynom->b = 0.0;
|
||||
polynom->c = 0.0;
|
||||
}
|
||||
|
||||
static void launch_argv(char *input)
|
||||
{
|
||||
int ret;
|
||||
@@ -92,8 +99,8 @@ static void launch_argv(char *input)
|
||||
remove_spaces(input);
|
||||
|
||||
// lexerize
|
||||
arg_len = ft_strlen(input) + 1; // +1 for last END token
|
||||
ft_printf("-> tokens[%i]\n", arg_len); // debug
|
||||
arg_len = ft_strlen(input) + 1; // +1 for last END token
|
||||
// ft_printf("-> tokens[%i]\n", arg_len); // debug
|
||||
s_token tokens[arg_len];
|
||||
tokens_g_err = tokens;
|
||||
tokens_fill_null(tokens, arg_len);
|
||||
@@ -105,7 +112,7 @@ static void launch_argv(char *input)
|
||||
|
||||
// parse
|
||||
terms_count_prediction = count_any_of(input, "-+=") + 2; // +1 for first term that can have no leading '+', +1 for last term == NULL
|
||||
ft_printf("-> terms[%i]\n", terms_count_prediction); // debug
|
||||
// ft_printf("-> terms[%i]\n", terms_count_prediction); // debug
|
||||
s_term terms[terms_count_prediction];
|
||||
terms_g_err = terms;
|
||||
terms_fill_null(terms, terms_count_prediction);
|
||||
@@ -118,6 +125,7 @@ static void launch_argv(char *input)
|
||||
// reduce
|
||||
s_polynom polynom[1];
|
||||
polynom_g_err = polynom;
|
||||
polynom_fill_null(polynom);
|
||||
reduce(terms, polynom);
|
||||
|
||||
// debug
|
||||
|
||||
Reference in New Issue
Block a user