mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cleanup: const-ify functions taking pointers to events
This is another entry in the series to make more things "const-clean" with the ultimate goal of merge_dive() take const pointers. This concerns functions taking pointers to events and the fallout from making these const. The somewhat debatable part of this commit might be that get_next_event() is split in a two distinct (const and non-const) versions with different names, since C doesn't allow overloading. The linker should recognize that these functions are identical and remove one of them. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
44f34d8cd7
commit
605e1e19ed
15 changed files with 76 additions and 69 deletions
|
@ -236,10 +236,10 @@ void process_selected_dives(void)
|
|||
|
||||
#define SOME_GAS 5000 // 5bar drop in cylinder pressure makes cylinder used
|
||||
|
||||
bool has_gaschange_event(struct dive *dive, struct divecomputer *dc, int idx)
|
||||
bool has_gaschange_event(const struct dive *dive, const struct divecomputer *dc, int idx)
|
||||
{
|
||||
bool first_gas_explicit = false;
|
||||
struct event *event = get_next_event(dc->events, "gaschange");
|
||||
const struct event *event = get_next_event(dc->events, "gaschange");
|
||||
while (event) {
|
||||
if (dc->sample && (event->time.seconds == 0 ||
|
||||
(dc->samples && dc->sample[0].time.seconds == event->time.seconds)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue