From b9f52d0aff470991568a7c1af5af529b0142e1e8 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sat, 22 Jul 2017 08:28:39 -0700 Subject: Gas usage statistics: don't require gas switch events Our "get_has_used()" helper only filled in gas usage for cylinders that had a gas change event associated with them. That works really badly for things like CCR, but also simply for cases where the dive computer wasn't necessarily explicitly notified about usage, like sidemount diving etc. Just remove the logic. If some use ends up particularly wanting to ignore some cylinder, they can always do it in the caller instead. Signed-off-by: Linus Torvalds Signed-off-by: Dirk Hohndel --- core/statistics.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/core/statistics.c b/core/statistics.c index d86fe6324..ff8122124 100644 --- a/core/statistics.c +++ b/core/statistics.c @@ -345,23 +345,11 @@ void get_gas_used(struct dive *dive, volume_t gases[MAX_CYLINDERS]) { int idx; struct divecomputer *dc; - bool used; for (idx = 0; idx < MAX_CYLINDERS; idx++) { - used = false; cylinder_t *cyl = &dive->cylinder[idx]; pressure_t start, end; - for_each_dc(dive, dc) { - if (same_string(dc->model, "planned dive")) - continue; - if (has_gaschange_event(dive, dc, idx)) - used = true; - } - - if (!used) - continue; - start = cyl->start.mbar ? cyl->start : cyl->sample_start; end = cyl->end.mbar ? cyl->end : cyl->sample_end; if (end.mbar && start.mbar > end.mbar) -- cgit v1.2.3-70-g09d2