summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/cochran.c6
-rw-r--r--core/datatrak.c2
-rw-r--r--core/equipment.c2
-rw-r--r--core/equipment.h2
-rw-r--r--core/libdivecomputer.c2
-rw-r--r--core/liquivision.c2
-rw-r--r--core/load-git.c4
-rw-r--r--core/parse-xml.c2
-rw-r--r--core/planner.c2
9 files changed, 13 insertions, 11 deletions
diff --git a/core/cochran.c b/core/cochran.c
index 632ba5bff..5955ddb69 100644
--- a/core/cochran.c
+++ b/core/cochran.c
@@ -675,7 +675,7 @@ static void cochran_parse_dive(const unsigned char *decode, unsigned mod,
case TYPE_GEMINI:
case TYPE_COMMANDER:
if (config.type == TYPE_GEMINI) {
- cylinder_t cyl = { 0 };
+ cylinder_t cyl = empty_cylinder;
dc->model = "Gemini";
dc->deviceid = buf[0x18c] * 256 + buf[0x18d]; // serial no
fill_default_cylinder(dive, &cyl);
@@ -687,7 +687,7 @@ static void cochran_parse_dive(const unsigned char *decode, unsigned mod,
dc->model = "Commander";
dc->deviceid = array_uint32_le(buf + 0x31e); // serial no
for (g = 0; g < 2; g++) {
- cylinder_t cyl = { 0 };
+ cylinder_t cyl = empty_cylinder;
fill_default_cylinder(dive, &cyl);
cyl.gasmix.o2.permille = (log[CMD_O2_PERCENT + g * 2] / 256
+ log[CMD_O2_PERCENT + g * 2 + 1]) * 10;
@@ -731,7 +731,7 @@ static void cochran_parse_dive(const unsigned char *decode, unsigned mod,
dc->model = "EMC";
dc->deviceid = array_uint32_le(buf + 0x31e); // serial no
for (g = 0; g < 4; g++) {
- cylinder_t cyl = { 0 };
+ cylinder_t cyl = empty_cylinder;
fill_default_cylinder(dive, &cyl);
cyl.gasmix.o2.permille =
(log[EMC_O2_PERCENT + g * 2] / 256
diff --git a/core/datatrak.c b/core/datatrak.c
index 728efe5ab..2d825cb37 100644
--- a/core/datatrak.c
+++ b/core/datatrak.c
@@ -317,7 +317,7 @@ static unsigned char *dt_dive_parser(unsigned char *runner, struct dive *dt_dive
*/
read_bytes(2);
if (tmp_2bytes != 0x7FFF) {
- cylinder_t cyl = { 0 };
+ cylinder_t cyl = empty_cylinder;
cyl.type.size.mliter = tmp_2bytes * 10;
cyl.type.description = "";
cyl.start.mbar = 200000;
diff --git a/core/equipment.c b/core/equipment.c
index ebdff9772..c9c0539c3 100644
--- a/core/equipment.c
+++ b/core/equipment.c
@@ -343,7 +343,7 @@ void copy_cylinder_types(const struct dive *s, struct dive *d)
cylinder_t *add_empty_cylinder(struct cylinder_table *t)
{
- cylinder_t cyl = { 0 };
+ cylinder_t cyl = empty_cylinder;
cyl.type.description = strdup("");
add_to_cylinder_table(t, t->nr, cyl);
return &t->cylinders[t->nr - 1];
diff --git a/core/equipment.h b/core/equipment.h
index 11d6f37c1..b62587447 100644
--- a/core/equipment.h
+++ b/core/equipment.h
@@ -33,6 +33,8 @@ typedef struct
bool bestmix_he;
} cylinder_t;
+static const cylinder_t empty_cylinder = { { { 0 }, { 0 }, (const char *)0}, { { 0 }, { 0 } } , { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, false, { 0 }, { 0 }, OC_GAS, false, false };
+
/* Table of cylinders. Attention: this stores cylinders,
* *not* pointers to cylinders. This has two crucial consequences:
* 1) Pointers to cylinders are not stable. They may be
diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c
index d3e5a115d..453bb4e2f 100644
--- a/core/libdivecomputer.c
+++ b/core/libdivecomputer.c
@@ -114,7 +114,7 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t
clear_cylinder_table(&dive->cylinders);
for (i = 0; i < ngases || i < ntanks; i++) {
- cylinder_t cyl = { 0 };
+ cylinder_t cyl = empty_cylinder;
if (i < ngases) {
dc_gasmix_t gasmix = { 0 };
int o2, he;
diff --git a/core/liquivision.c b/core/liquivision.c
index 1ea2b814a..905091dd8 100644
--- a/core/liquivision.c
+++ b/core/liquivision.c
@@ -149,7 +149,7 @@ static void parse_dives(int log_version, const unsigned char *buf, unsigned int
/* Just the main cylinder until we can handle the buddy cylinder porperly */
for (i = 0; i < 1; i++) {
- cylinder_t cyl = { 0 };
+ cylinder_t cyl = empty_cylinder;
fill_default_cylinder(dive, &cyl);
add_to_cylinder_table(&dive->cylinders, i, cyl);
}
diff --git a/core/load-git.c b/core/load-git.c
index add7afe8c..efdb52940 100644
--- a/core/load-git.c
+++ b/core/load-git.c
@@ -405,7 +405,7 @@ static void parse_cylinder_keyvalue(void *_cylinder, const char *key, const char
static void parse_dive_cylinder(char *line, struct membuffer *str, struct git_parser_state *state)
{
- cylinder_t cylinder = { 0 };
+ cylinder_t cylinder = empty_cylinder;
cylinder.type.description = get_utf8(str);
for (;;) {
@@ -437,7 +437,7 @@ static void parse_weightsystem_keyvalue(void *_ws, const char *key, const char *
static void parse_dive_weightsystem(char *line, struct membuffer *str, struct git_parser_state *state)
{
- weightsystem_t ws = { 0 };
+ weightsystem_t ws = empty_weightsystem;
ws.description = get_utf8(str);
for (;;) {
diff --git a/core/parse-xml.c b/core/parse-xml.c
index a7aec8c6a..4058603d3 100644
--- a/core/parse-xml.c
+++ b/core/parse-xml.c
@@ -1003,7 +1003,7 @@ static void divinglog_place(char *place, struct dive *d, struct parser_state *st
static int divinglog_dive_match(struct dive *dive, const char *name, char *buf, struct parser_state *state)
{
/* For cylinder related fields, we might have to create a cylinder first. */
- cylinder_t cyl = { 0 };
+ cylinder_t cyl = empty_cylinder;
if (MATCH("tanktype", utf8_string, &cyl.type.description)) {
cylinder_t *cyl0 = get_or_create_cylinder(dive, 0);
free((void *)cyl0->type.description);
diff --git a/core/planner.c b/core/planner.c
index 51453e1ee..0e26a9a57 100644
--- a/core/planner.c
+++ b/core/planner.c
@@ -1103,7 +1103,7 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
if (prefs.surface_segment != 0) {
// Switch to an empty air cylinder for breathing air at the surface
// If no empty cylinder is found, keep using last deco gas
- cylinder_t cyl = { 0 };
+ cylinder_t cyl = empty_cylinder;
cyl.cylinder_use = NOT_USED;
add_to_cylinder_table(&dive->cylinders, dive->cylinders.nr, cyl);
current_cylinder = dive->cylinders.nr - 1;