From dc67876c7955b21f969545eee6f3ae3bdb550787 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 3 Nov 2019 23:08:32 +0100 Subject: Cleanup: introduce empty_weightsystem constant To make things more future-proof, introduce an empty_weightsystem constant. Replace explicit aggragate initialization of empty weightsystems by this constant. Signed-off-by: Berthold Stoeger --- core/equipment.h | 2 ++ core/parse.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/equipment.h b/core/equipment.h index 687e794a5..2711d7703 100644 --- a/core/equipment.h +++ b/core/equipment.h @@ -50,6 +50,8 @@ typedef struct const char *description; /* "integrated", "belt", "ankle" */ } weightsystem_t; +static const weightsystem_t empty_weightsystem = { { 0 }, 0 }; + /* Table of weightsystems. Attention: this stores weightsystems, * *not* pointers * to weightsystems. This has two crucial * consequences: diff --git a/core/parse.c b/core/parse.c index 30d6a8ad5..56e5928fc 100644 --- a/core/parse.c +++ b/core/parse.c @@ -298,8 +298,7 @@ void cylinder_end(struct parser_state *state) void ws_start(struct parser_state *state) { - weightsystem_t w = { {0}, "" }; - add_cloned_weightsystem(&state->cur_dive->weightsystems, w); + add_cloned_weightsystem(&state->cur_dive->weightsystems, empty_weightsystem); } void ws_end(struct parser_state *state) -- cgit v1.2.3-70-g09d2