[PATCH] Be much more careful about merging dives
Dirk Hohndel
dirk at hohndel.org
Tue Sep 22 19:35:54 PDT 2015
On Tue, Sep 22, 2015 at 12:43:30PM -0700, Linus Torvalds wrote:
> +
> +/*
> + * The end of a dive is actually not trivial, because "duration"
> + * is not the duration until the end, but the time we spend under
> + * water, which can be very different if there are surface events
> + * during the dive.
> + *
> + * So walk the dive computers, looking for the longest actual
> + * time in the samples (and just default to the dive duration if
> + * there are no samples).
> + */
> +static inline int dive_totaltime(const struct dive *dive)
> +{
> + int time = dive->duration.seconds;
> + struct divecomputer *dc;
> +
> + for_each_dc(dive, dc) {
This gives me a warning when I compile it:
In file included from /home/hohndel/subsurface/dive.c:8:0:
/home/hohndel/subsurface/dive.c: In function ‘dive_totaltime’:
/home/hohndel/subsurface/dive.h:582:11: warning: assignment discards
‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
for (_dc = &_dive->dc; _dc; _dc = _dc->next)
^
/home/hohndel/subsurface/dive.c:2853:2: note: in expansion of macro ‘for_each_dc’
for_each_dc(dive, dc) {
^
Declaring dc as
const struct divecomputer *dc;
fixes that. Any issues with that?
/D
More information about the subsurface
mailing list