summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/datatrak.h2
-rw-r--r--core/dive.c67
-rw-r--r--core/dive.h33
-rw-r--r--core/divelist.c36
-rw-r--r--core/divelist.h6
-rw-r--r--core/parse.h2
-rw-r--r--core/statistics.c8
7 files changed, 77 insertions, 77 deletions
diff --git a/core/datatrak.h b/core/datatrak.h
index 7aea1741f..05534fcee 100644
--- a/core/datatrak.h
+++ b/core/datatrak.h
@@ -41,8 +41,6 @@ static const struct models_table_t g_models[] = {
{0xEE, 0x44, "Uwatec Unknown model", DC_FAMILY_UWATEC_ALADIN},
};
-extern struct sample *add_sample(struct sample *sample, int time, struct divecomputer *dc);
-
#define JUMP(_ptr, _n) if ((long) (_ptr += _n) > maxbuf) goto bail
#define CHECK(_ptr, _n) if ((long) _ptr + _n > maxbuf) goto bail
#define read_bytes(_n) \
diff --git a/core/dive.c b/core/dive.c
index 2a88f73f1..535810901 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -99,13 +99,13 @@ void add_sample_pressure(struct sample *sample, int sensor, int mbar)
* This function returns a negative number for "no legacy mode",
* or a non-negative number that indicates the o2 sensor index.
*/
-int legacy_format_o2pressures(struct dive *dive, struct divecomputer *dc)
+int legacy_format_o2pressures(const struct dive *dive, const struct divecomputer *dc)
{
int i, o2sensor;
o2sensor = (dc->divemode == CCR) ? get_cylinder_idx_by_use(dive, OXYGEN) : -1;
for (i = 0; i < dc->samples; i++) {
- struct sample *s = dc->sample + i;
+ const struct sample *s = dc->sample + i;
int seen_pressure = 0, idx;
for (idx = 0; idx < MAX_SENSORS; idx++) {
@@ -480,7 +480,7 @@ static void free_pic(struct picture *picture);
/* this is very different from the copy_divecomputer later in this file;
* this function actually makes full copies of the content */
-static void copy_dc(struct divecomputer *sdc, struct divecomputer *ddc)
+static void copy_dc(const struct divecomputer *sdc, struct divecomputer *ddc)
{
*ddc = *sdc;
ddc->model = copy_string(sdc->model);
@@ -556,7 +556,7 @@ void clear_dive(struct dive *d)
/* make a true copy that is independent of the source dive;
* all data structures are duplicated, so the copy can be modified without
* any impact on the source */
-void copy_dive(struct dive *s, struct dive *d)
+void copy_dive(const struct dive *s, struct dive *d)
{
clear_dive(d);
/* simply copy things over, but then make actual copies of the
@@ -597,7 +597,7 @@ struct dive *clone_dive(struct dive *s)
d->_component = copy_string(s->_component)
// copy elements, depending on bits in what that are set
-void selective_copy_dive(struct dive *s, struct dive *d, struct dive_components what, bool clear)
+void selective_copy_dive(const struct dive *s, struct dive *d, struct dive_components what, bool clear)
{
if (clear)
clear_dive(d);
@@ -641,9 +641,10 @@ struct event *clone_event(const struct event *src_ev)
}
/* copies all events in this dive computer */
-void copy_events(struct divecomputer *s, struct divecomputer *d)
+void copy_events(const struct divecomputer *s, struct divecomputer *d)
{
- struct event *ev, **pev;
+ const struct event *ev;
+ struct event **pev;
if (!s || !d)
return;
ev = s->events;
@@ -657,24 +658,24 @@ void copy_events(struct divecomputer *s, struct divecomputer *d)
*pev = NULL;
}
-int nr_cylinders(struct dive *dive)
+int nr_cylinders(const struct dive *dive)
{
int nr;
for (nr = MAX_CYLINDERS; nr; --nr) {
- cylinder_t *cylinder = dive->cylinder + nr - 1;
+ const cylinder_t *cylinder = dive->cylinder + nr - 1;
if (!cylinder_nodata(cylinder))
break;
}
return nr;
}
-int nr_weightsystems(struct dive *dive)
+int nr_weightsystems(const struct dive *dive)
{
int nr;
for (nr = MAX_WEIGHTSYSTEMS; nr; --nr) {
- weightsystem_t *ws = dive->weightsystem + nr - 1;
+ const weightsystem_t *ws = dive->weightsystem + nr - 1;
if (!weightsystem_none(ws))
break;
}
@@ -682,7 +683,7 @@ int nr_weightsystems(struct dive *dive)
}
/* copy the equipment data part of the cylinders */
-void copy_cylinders(struct dive *s, struct dive *d, bool used_only)
+void copy_cylinders(const struct dive *s, struct dive *d, bool used_only)
{
int i,j;
cylinder_t t[MAX_CYLINDERS];
@@ -728,7 +729,7 @@ int cylinderuse_from_text(const char *text)
return -1;
}
-void copy_samples(struct divecomputer *s, struct divecomputer *d)
+void copy_samples(const struct divecomputer *s, struct divecomputer *d)
{
/* instead of carefully copying them one by one and calling add_sample
* over and over again, let's just copy the whole blob */
@@ -875,13 +876,13 @@ void fixup_dc_duration(struct divecomputer *dc)
/* Which cylinders had gas used? */
#define SOME_GAS 5000
-static unsigned int get_cylinder_used(struct dive *dive)
+static unsigned int get_cylinder_used(const struct dive *dive)
{
int i;
unsigned int mask = 0;
for (i = 0; i < MAX_CYLINDERS; i++) {
- cylinder_t *cyl = dive->cylinder + i;
+ const cylinder_t *cyl = dive->cylinder + i;
int start_mbar, end_mbar;
if (cylinder_nodata(cyl))
@@ -898,7 +899,7 @@ static unsigned int get_cylinder_used(struct dive *dive)
}
/* Which cylinders do we know usage about? */
-static unsigned int get_cylinder_known(struct dive *dive, struct divecomputer *dc)
+static unsigned int get_cylinder_known(const struct dive *dive, const struct divecomputer *dc)
{
unsigned int mask = 0;
const struct event *ev;
@@ -925,7 +926,7 @@ static unsigned int get_cylinder_known(struct dive *dive, struct divecomputer *d
return mask;
}
-void per_cylinder_mean_depth(struct dive *dive, struct divecomputer *dc, int *mean, int *duration)
+void per_cylinder_mean_depth(const struct dive *dive, struct divecomputer *dc, int *mean, int *duration)
{
int i;
int depthtime[MAX_CYLINDERS] = { 0, };
@@ -1018,7 +1019,7 @@ static void update_min_max_temperatures(struct dive *dive, temperature_t tempera
}
}
-int gas_volume(cylinder_t *cyl, pressure_t p)
+int gas_volume(const cylinder_t *cyl, pressure_t p)
{
double bar = p.mbar / 1000.0;
double z_factor = gas_compressibility_factor(cyl->gasmix, bar);
@@ -1330,7 +1331,7 @@ static void fixup_duration(struct dive *dive)
* What do the dive computers say the water temperature is?
* (not in the samples, but as dc property for dcs that support that)
*/
-unsigned int dc_watertemp(struct divecomputer *dc)
+unsigned int dc_watertemp(const struct divecomputer *dc)
{
int sum = 0, nr = 0;
@@ -1354,7 +1355,7 @@ static void fixup_watertemp(struct dive *dive)
/*
* What do the dive computers say the air temperature is?
*/
-unsigned int dc_airtemp(struct divecomputer *dc)
+unsigned int dc_airtemp(const struct divecomputer *dc)
{
int sum = 0, nr = 0;
@@ -1803,7 +1804,7 @@ struct dive *fixup_dive(struct dive *dive)
#define MERGE_TXT(res, a, b, n, sep) res->n = merge_text(a->n, b->n, sep)
#define MERGE_NONZERO(res, a, b, n) res->n = a->n ? a->n : b->n
-struct sample *add_sample(struct sample *sample, int time, struct divecomputer *dc)
+struct sample *add_sample(const struct sample *sample, int time, struct divecomputer *dc)
{
struct sample *p = prepare_sample(dc);
@@ -2055,7 +2056,7 @@ static void merge_events(struct divecomputer *res, struct divecomputer *src1, st
}
}
-static void merge_weightsystem_info(weightsystem_t *res, weightsystem_t *a, weightsystem_t *b)
+static void merge_weightsystem_info(weightsystem_t *res, const weightsystem_t *a, const weightsystem_t *b)
{
if (!a->weight.grams)
a = b;
@@ -2229,7 +2230,7 @@ static int pdiff(pressure_t a, pressure_t b)
return a.mbar && b.mbar && a.mbar != b.mbar;
}
-static int different_manual_pressures(cylinder_t *a, cylinder_t *b)
+static int different_manual_pressures(const cylinder_t *a, const cylinder_t *b)
{
return pdiff(a->start, b->start) || pdiff(a->end, b->end);
}
@@ -2243,12 +2244,12 @@ static int different_manual_pressures(cylinder_t *a, cylinder_t *b)
* same cylinder use (ie OC/Diluent/Oxygen), and if pressures
* have been added manually they need to match.
*/
-static int match_cylinder(cylinder_t *cyl, struct dive *dive, unsigned int available)
+static int match_cylinder(const cylinder_t *cyl, const struct dive *dive, unsigned int available)
{
int i;
for (i = 0; i < MAX_CYLINDERS; i++) {
- cylinder_t *target;
+ const cylinder_t *target;
if (!(available & (1u << i)))
continue;
@@ -2424,7 +2425,7 @@ static void merge_temperatures(struct dive *res, struct dive *a, struct dive *b)
* The 'next' dive is not involved in the dive merging, but is the dive
* that will be the next dive after the merged dive.
*/
-static void pick_trip(struct dive *res, struct dive *pick)
+static void pick_trip(struct dive *res, const struct dive *pick)
{
tripflag_t tripflag = pick->tripflag;
dive_trip_t *trip = pick->divetrip;
@@ -2689,7 +2690,7 @@ static int similar(unsigned long a, unsigned long b, unsigned long expected)
* positive for "same dive" and negative for "definitely
* not the same dive"
*/
-int match_one_dc(struct divecomputer *a, struct divecomputer *b)
+int match_one_dc(const struct divecomputer *a, const struct divecomputer *b)
{
/* Not same model? Don't know if matching.. */
if (!a->model || !b->model)
@@ -2721,10 +2722,10 @@ int match_one_dc(struct divecomputer *a, struct divecomputer *b)
* 0 for "don't know"
* 1 for "is definitely the same dive"
*/
-static int match_dc_dive(struct divecomputer *a, struct divecomputer *b)
+static int match_dc_dive(const struct divecomputer *a, const struct divecomputer *b)
{
do {
- struct divecomputer *tmp = b;
+ const struct divecomputer *tmp = b;
do {
int match = match_one_dc(a, tmp);
if (match)
@@ -2736,7 +2737,7 @@ static int match_dc_dive(struct divecomputer *a, struct divecomputer *b)
return 0;
}
-static bool new_without_trip(struct dive *a)
+static bool new_without_trip(const struct dive *a)
{
return a->downloaded && !a->divetrip;
}
@@ -2770,7 +2771,7 @@ static bool new_without_trip(struct dive *a)
* dives together manually. But this tries to handle the sane
* cases.
*/
-static int likely_same_dive(struct dive *a, struct dive *b)
+static int likely_same_dive(const struct dive *a, const struct dive *b)
{
int match, fuzz = 20 * 60;
@@ -2898,7 +2899,7 @@ static int same_dc(struct divecomputer *a, struct divecomputer *b)
return eva == evb;
}
-static int might_be_same_device(struct divecomputer *a, struct divecomputer *b)
+static int might_be_same_device(const struct divecomputer *a, const struct divecomputer *b)
{
/* No dive computer model? That matches anything */
if (!a->model || !b->model)
@@ -2957,7 +2958,7 @@ static struct divecomputer *find_matching_computer(struct divecomputer *match, s
}
-static void copy_dive_computer(struct divecomputer *res, struct divecomputer *a)
+static void copy_dive_computer(struct divecomputer *res, const struct divecomputer *a)
{
*res = *a;
res->model = copy_string(a->model);
diff --git a/core/dive.h b/core/dive.h
index 9c56f1070..4c24dad74 100644
--- a/core/dive.h
+++ b/core/dive.h
@@ -113,7 +113,7 @@ extern depth_t units_to_depth(double depth);
extern int units_to_sac(double volume);
/* Volume in mliter of a cylinder at pressure 'p' */
-extern int gas_volume(cylinder_t *cyl, pressure_t p);
+extern int gas_volume(const cylinder_t *cyl, pressure_t p);
extern double gas_compressibility_factor(struct gasmix gas, double bar);
extern double isothermal_pressure(struct gasmix gas, double p1, int volume1, int volume2);
extern double gas_density(struct gasmix gas, int pressure);
@@ -487,7 +487,7 @@ extern bool time_during_dive_with_offset(struct dive *dive, timestamp_t when, ti
struct dive *find_dive_n_near(timestamp_t when, int n, timestamp_t offset);
/* Check if two dive computer entries are the exact same dive (-1=no/0=maybe/1=yes) */
-extern int match_one_dc(struct divecomputer *a, struct divecomputer *b);
+extern int match_one_dc(const struct divecomputer *a, const struct divecomputer *b);
extern void parse_xml_init(void);
extern int parse_xml_buffer(const char *url, const char *buf, int size, struct dive_table *table, const char **params);
@@ -547,8 +547,8 @@ extern struct dive *alloc_dive(void);
extern void record_dive_to_table(struct dive *dive, struct dive_table *table);
extern void record_dive(struct dive *dive);
extern void clear_dive(struct dive *dive);
-extern void copy_dive(struct dive *s, struct dive *d);
-extern void selective_copy_dive(struct dive *s, struct dive *d, struct dive_components what, bool clear);
+extern void copy_dive(const struct dive *s, struct dive *d);
+extern void selective_copy_dive(const struct dive *s, struct dive *d, struct dive_components what, bool clear);
extern struct dive *clone_dive(struct dive *s);
extern void clear_table(struct dive_table *table);
@@ -557,37 +557,38 @@ extern void alloc_samples(struct divecomputer *dc, int num);
extern void free_samples(struct divecomputer *dc);
extern struct sample *prepare_sample(struct divecomputer *dc);
extern void finish_sample(struct divecomputer *dc);
+extern struct sample *add_sample(const struct sample *sample, int time, struct divecomputer *dc);
extern void add_sample_pressure(struct sample *sample, int sensor, int mbar);
-extern int legacy_format_o2pressures(struct dive *dive, struct divecomputer *dc);
+extern int legacy_format_o2pressures(const struct dive *dive, const struct divecomputer *dc);
extern void sort_table(struct dive_table *table);
extern struct dive *fixup_dive(struct dive *dive);
extern void fixup_dc_duration(struct divecomputer *dc);
extern int dive_getUniqID();
-extern unsigned int dc_airtemp(struct divecomputer *dc);
-extern unsigned int dc_watertemp(struct divecomputer *dc);
+extern unsigned int dc_airtemp(const struct divecomputer *dc);
+extern unsigned int dc_watertemp(const struct divecomputer *dc);
extern int split_dive(struct dive *);
extern void split_dive_at_time(struct dive *dive, duration_t time);
extern struct dive *merge_dives(struct dive *a, struct dive *b, int offset, bool prefer_downloaded);
extern struct dive *try_to_merge(struct dive *a, struct dive *b, bool prefer_downloaded);
extern struct event *clone_event(const struct event *src_ev);
-extern void copy_events(struct divecomputer *s, struct divecomputer *d);
+extern void copy_events(const struct divecomputer *s, struct divecomputer *d);
extern void free_events(struct event *ev);
-extern void copy_cylinders(struct dive *s, struct dive *d, bool used_only);
-extern void copy_samples(struct divecomputer *s, struct divecomputer *d);
-extern bool is_cylinder_used(struct dive *dive, int idx);
-extern bool is_cylinder_prot(struct dive *dive, int idx);
+extern void copy_cylinders(const struct dive *s, struct dive *d, bool used_only);
+extern void copy_samples(const struct divecomputer *s, struct divecomputer *d);
+extern bool is_cylinder_used(const struct dive *dive, int idx);
+extern bool is_cylinder_prot(const struct dive *dive, int idx);
extern void fill_default_cylinder(cylinder_t *cyl);
extern void add_gas_switch_event(struct dive *dive, struct divecomputer *dc, int time, int idx);
extern struct event *add_event(struct divecomputer *dc, unsigned int time, int type, int flags, int value, const char *name);
extern void remove_event(struct event *event);
extern void update_event_name(struct dive *d, struct event *event, const char *name);
extern void add_extra_data(struct divecomputer *dc, const char *key, const char *value);
-extern void per_cylinder_mean_depth(struct dive *dive, struct divecomputer *dc, int *mean, int *duration);
+extern void per_cylinder_mean_depth(const struct dive *dive, struct divecomputer *dc, int *mean, int *duration);
extern int get_cylinder_index(const struct dive *dive, const struct event *ev);
extern struct gasmix get_gasmix_from_event(const struct dive *, const struct event *ev);
-extern int nr_cylinders(struct dive *dive);
-extern int nr_weightsystems(struct dive *dive);
+extern int nr_cylinders(const struct dive *dive);
+extern int nr_weightsystems(const struct dive *dive);
/* UI related protopypes */
@@ -606,7 +607,7 @@ extern void clear_events(void);
extern void set_dc_nickname(struct dive *dive);
extern void set_autogroup(bool value);
-extern int total_weight(struct dive *);
+extern int total_weight(const struct dive *);
#ifdef __cplusplus
}
diff --git a/core/divelist.c b/core/divelist.c
index 44ad7c79f..f643d14f6 100644
--- a/core/divelist.c
+++ b/core/divelist.c
@@ -7,8 +7,9 @@
* unsigned int amount_selected;
* void dump_selection(void)
* void get_dive_gas(struct dive *dive, int *o2_p, int *he_p, int *o2low_p)
- * int total_weight(struct dive *dive)
- * int get_divenr(struct dive *dive)
+ * int total_weight(const struct dive *dive)
+ * int get_divenr(const struct dive *dive)
+ * int get_divesite_idx(const struct dive_site *ds)
* int init_decompression(struct dive *dive)
* void update_cylinder_related_info(struct dive *dive)
* void dump_trip_list(void)
@@ -26,6 +27,7 @@
* int unsaved_changes()
* void remove_autogen_trips()
* void sort_table(struct dive_table *table)
+ * bool is_trip_before_after(const struct dive *dive, bool before)
*/
#include <unistd.h>
#include <stdio.h>
@@ -122,7 +124,7 @@ void get_dive_gas(struct dive *dive, int *o2_p, int *he_p, int *o2max_p)
*o2max_p = maxo2;
}
-int total_weight(struct dive *dive)
+int total_weight(const struct dive *dive)
{
int i, total_grams = 0;
@@ -132,18 +134,18 @@ int total_weight(struct dive *dive)
return total_grams;
}
-static int active_o2(struct dive *dive, struct divecomputer *dc, duration_t time)
+static int active_o2(const struct dive *dive, const struct divecomputer *dc, duration_t time)
{
struct gasmix gas = get_gasmix_at_time(dive, dc, time);
return get_o2(gas);
}
/* calculate OTU for a dive - this only takes the first divecomputer into account */
-static int calculate_otu(struct dive *dive)
+static int calculate_otu(const struct dive *dive)
{
int i;
double otu = 0.0;
- struct divecomputer *dc = &dive->dc;
+ const struct divecomputer *dc = &dive->dc;
for (i = 1; i < dc->samples; i++) {
int t;
@@ -179,11 +181,11 @@ int const cns_table[][3] = {
};
/* Calculate the CNS for a single dive */
-double calculate_cns_dive(struct dive *dive)
+static double calculate_cns_dive(const struct dive *dive)
{
int n;
size_t j;
- struct divecomputer *dc = &dive->dc;
+ const struct divecomputer *dc = &dive->dc;
double cns = 0.0;
/* Caclulate the CNS for each sample in this dive and sum them */
@@ -345,14 +347,14 @@ static int calculate_cns(struct dive *dive)
/*
* Return air usage (in liters).
*/
-static double calculate_airuse(struct dive *dive)
+static double calculate_airuse(const struct dive *dive)
{
int airuse = 0;
int i;
for (i = 0; i < MAX_CYLINDERS; i++) {
pressure_t start, end;
- cylinder_t *cyl = dive->cylinder + i;
+ const cylinder_t *cyl = dive->cylinder + i;
start = cyl->start.mbar ? cyl->start : cyl->sample_start;
end = cyl->end.mbar ? cyl->end : cyl->sample_end;
@@ -373,9 +375,9 @@ static double calculate_airuse(struct dive *dive)
}
/* this only uses the first divecomputer to calculate the SAC rate */
-static int calculate_sac(struct dive *dive)
+static int calculate_sac(const struct dive *dive)
{
- struct divecomputer *dc = &dive->dc;
+ const struct divecomputer *dc = &dive->dc;
double airuse, pressure, sac;
int duration, meandepth;
@@ -427,10 +429,10 @@ static void add_dive_to_deco(struct deco_state *ds, struct dive *dive)
}
}
-int get_divenr(struct dive *dive)
+int get_divenr(const struct dive *dive)
{
int i;
- struct dive *d;
+ const struct dive *d;
// tempting as it may be, don't die when called with dive=NULL
if (dive)
for_each_dive(i, d) {
@@ -440,10 +442,10 @@ int get_divenr(struct dive *dive)
return -1;
}
-int get_divesite_idx(struct dive_site *ds)
+int get_divesite_idx(const struct dive_site *ds)
{
int i;
- struct dive_site *d;
+ const struct dive_site *d;
// tempting as it may be, don't die when called with dive=NULL
if (ds)
for_each_dive_site(i, d) {
@@ -775,7 +777,7 @@ void find_new_trip_start_time(dive_trip_t *trip)
}
/* check if we have a trip right before / after this dive */
-bool is_trip_before_after(struct dive *dive, bool before)
+bool is_trip_before_after(const struct dive *dive, bool before)
{
int idx = get_idx_by_uniq_id(dive->id);
if (before) {
diff --git a/core/divelist.h b/core/divelist.h
index d014b4df1..5467f10ae 100644
--- a/core/divelist.h
+++ b/core/divelist.h
@@ -23,8 +23,8 @@ extern char *get_dive_gas_string(struct dive *dive);
struct dive **grow_dive_table(struct dive_table *table);
extern void get_dive_gas(struct dive *dive, int *o2_p, int *he_p, int *o2low_p);
-extern int get_divenr(struct dive *dive);
-extern int get_divesite_idx(struct dive_site *ds);
+extern int get_divenr(const struct dive *dive);
+extern int get_divesite_idx(const struct dive_site *ds);
extern void remove_dive_from_trip(struct dive *dive, short was_autogen);
extern dive_trip_t *create_and_hookup_trip_from_dive(struct dive *dive);
extern void autogroup_dives(void);
@@ -39,7 +39,7 @@ extern void combine_trips(struct dive_trip *trip_a, struct dive_trip *trip_b);
extern void find_new_trip_start_time(dive_trip_t *trip);
extern struct dive *first_selected_dive();
extern struct dive *last_selected_dive();
-extern bool is_trip_before_after(struct dive *dive, bool before);
+extern bool is_trip_before_after(const struct dive *dive, bool before);
extern void set_dive_nr_for_current_dive();
int get_min_datafile_version();
diff --git a/core/parse.h b/core/parse.h
index affffcfb0..2a666ec4d 100644
--- a/core/parse.h
+++ b/core/parse.h
@@ -59,8 +59,6 @@ extern int diveid;
int trimspace(char *buffer);
void clear_table(struct dive_table *table);
-void record_dive_to_table(struct dive *dive, struct dive_table *table);
-void record_dive(struct dive *dive);
void start_match(const char *type, const char *name, char *buffer);
void nonmatch(const char *type, const char *name, char *buffer);
typedef void (*matchfn_t)(char *buffer, void *);
diff --git a/core/statistics.c b/core/statistics.c
index b518a9c7f..beeb258a6 100644
--- a/core/statistics.c
+++ b/core/statistics.c
@@ -257,9 +257,9 @@ bool has_gaschange_event(const struct dive *dive, const struct divecomputer *dc,
return !first_gas_explicit && idx == 0;
}
-bool is_cylinder_used(struct dive *dive, int idx)
+bool is_cylinder_used(const struct dive *dive, int idx)
{
- struct divecomputer *dc;
+ const struct divecomputer *dc;
if (cylinder_none(&dive->cylinder[idx]))
return false;
@@ -276,9 +276,9 @@ bool is_cylinder_used(struct dive *dive, int idx)
return false;
}
-bool is_cylinder_prot(struct dive *dive, int idx)
+bool is_cylinder_prot(const struct dive *dive, int idx)
{
- struct divecomputer *dc;
+ const struct divecomputer *dc;
if (cylinder_none(&dive->cylinder[idx]))
return false;