diff options
authorLars Henriksen <LarsHenriksen@get2net.dk>2019-03-07 20:38:08 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2019-05-22 01:56:59 -0400
commit06a4449afae29d4dd0e5d49249674511bb1f4489 (patch)
parentdf2cb2a9c024b167fdca3b0b91e27fe7bb47b5a8 (diff)
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>
1 files changed, 1 insertions, 0 deletions
diff --git a/src/day.c b/src/day.c
index 50d6639..96b863a 100644
--- a/src/day.c
+++ b/src/day.c
@@ -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);