cleanup: fix enum in profile.c

There are two enums related to the type of dive.
There is the global

enum divemode_t {OC, CCR, PSCR, FREEDIVE, NUM_DIVEMODE,
                 UNDEF_COMP_TYPE};

and the anonymous

enum {AIR, NITROX, TRIMIX, FREEDIVING} dive_type;

in struct plot_info.

In profile.c FREEDIVE (of divemode_t) is assigned to dive_type.
This only works because by chance(?) FREEDIVE and FREEDIVING are
the fourth element of each enum.

Fix this. C truly is a bad language when it comes to types
(very weak) and namespaces (non existing).

Contains whitespace fix.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-01-13 10:46:36 +01:00 committed by Dirk Hohndel
parent 1b7daeee22
commit 798e426926

View file

@ -1302,8 +1302,8 @@ void create_plot_info_new(const struct dive *dive, const struct divecomputer *dc
free_plot_info_data(pi);
calculate_max_limits_new(dive, dc, pi, in_planner);
get_dive_gas(dive, &o2, &he, &o2max);
if (dc->divemode == FREEDIVE){
pi->dive_type = FREEDIVE;
if (dc->divemode == FREEDIVE) {
pi->dive_type = FREEDIVING;
} else if (he > 0) {
pi->dive_type = TRIMIX;
} else {