Fix initialization of the day_items vector

This patch fixes all failings tests, but one, in PR #193.

Until now the missing initialization of day_items_nb has caused no
problems, because the variable was assigned to (=) before being used. In
the Multiple days implementation it is repeatedly increased (+=) in a
loop without being initialized first. Indeed, this may considered an
easily fixed bug. But the initialization really belongs in
day_init_vector() so that the call day_item_count(0) returns 0 if done
right after the call day_init_vector(). The bug only shows up in command
line mode because day_items_nb is not used in interactive mode.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lars Henriksen 2019-03-07 20:38:08 +01:00 committed by Lukas Fleischer
parent df2cb2a9c0
commit 06a4449afa

View File

@ -52,6 +52,7 @@ static void day_free(struct day_item *day)
static void day_init_vector(void)
{
day_items_nb = 0;
VECTOR_INIT(&day_items, 16);
}