[PATCH 3/3] Use get_gas_at_time in active_o2

Anton Lundin glance at acc.umu.se
Thu Jul 17 12:16:51 PDT 2014


get_gas_at_time is now just a wrapper to return the o2 part of the
active gas at a certain time.

Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 divelist.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/divelist.c b/divelist.c
index 1a2111f..45a78f3 100644
--- a/divelist.c
+++ b/divelist.c
@@ -152,17 +152,9 @@ int total_weight(struct dive *dive)
 
 static int active_o2(struct dive *dive, struct divecomputer *dc, duration_t time)
 {
-	int o2permille = get_o2(&dive->cylinder[0].gasmix);
-	struct event *event;
-
-	for (event = dc->events; event; event = event->next) {
-		if (event->time.seconds > time.seconds)
-			break;
-		if (strcmp(event->name, "gaschange"))
-			continue;
-		o2permille = get_o2(get_gasmix_from_event(event));
-	}
-	return o2permille;
+	struct gasmix gas;
+	get_gas_at_time(dive, dc, time, &gas);
+	return get_o2(&gas);
 }
 
 /* calculate OTU for a dive - this only takes the first divecomputer into account */
-- 
1.9.1



More information about the subsurface mailing list