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)
|
static void launch_argv(char *input)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@@ -93,7 +100,7 @@ static void launch_argv(char *input)
|
|||||||
|
|
||||||
// lexerize
|
// lexerize
|
||||||
arg_len = ft_strlen(input) + 1; // +1 for last END token
|
arg_len = ft_strlen(input) + 1; // +1 for last END token
|
||||||
ft_printf("-> tokens[%i]\n", arg_len); // debug
|
// ft_printf("-> tokens[%i]\n", arg_len); // debug
|
||||||
s_token tokens[arg_len];
|
s_token tokens[arg_len];
|
||||||
tokens_g_err = tokens;
|
tokens_g_err = tokens;
|
||||||
tokens_fill_null(tokens, arg_len);
|
tokens_fill_null(tokens, arg_len);
|
||||||
@@ -105,7 +112,7 @@ static void launch_argv(char *input)
|
|||||||
|
|
||||||
// parse
|
// parse
|
||||||
terms_count_prediction = count_any_of(input, "-+=") + 2; // +1 for first term that can have no leading '+', +1 for last term == NULL
|
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];
|
s_term terms[terms_count_prediction];
|
||||||
terms_g_err = terms;
|
terms_g_err = terms;
|
||||||
terms_fill_null(terms, terms_count_prediction);
|
terms_fill_null(terms, terms_count_prediction);
|
||||||
@@ -118,6 +125,7 @@ static void launch_argv(char *input)
|
|||||||
// reduce
|
// reduce
|
||||||
s_polynom polynom[1];
|
s_polynom polynom[1];
|
||||||
polynom_g_err = polynom;
|
polynom_g_err = polynom;
|
||||||
|
polynom_fill_null(polynom);
|
||||||
reduce(terms, polynom);
|
reduce(terms, polynom);
|
||||||
|
|
||||||
// debug
|
// debug
|
||||||
|
|||||||
Reference in New Issue
Block a user