summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2013-03-28 10:06:43 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-03-28 13:47:31 -0700
commit1b05d28944ef72a62e788efdac2dcdc2dc4771ef (patch)
treed5370ac643f1087d9d794a43485658dc2f848574 /dive.c
parent99070c49e2ed1834c7371ce7500d78895e85e67c (diff)
downloadsubsurface-1b05d28944ef72a62e788efdac2dcdc2dc4771ef.tar.gz
Use the new get_o2()/get_he() helper functions more widely
They do the "02=0 means air" thing autmatically, and make for less typing. So use them more widely in places that looked up the o2 and he permille values of a gasmix. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/dive.c b/dive.c
index a43c1afc4..46121848c 100644
--- a/dive.c
+++ b/dive.c
@@ -1021,9 +1021,8 @@ static void merge_weightsystem_info(weightsystem_t *res, weightsystem_t *a, weig
static int gasmix_distance(const struct gasmix *a, const struct gasmix *b)
{
- int a_o2 = a->o2.permille ? : O2_IN_AIR;
- int b_o2 = b->o2.permille ? : O2_IN_AIR;
- int a_he = a->he.permille, b_he = b->he.permille;
+ int a_o2 = get_o2(a), b_o2 = get_o2(b);
+ int a_he = get_he(a), b_he = get_he(b);
int delta_o2 = a_o2 - b_o2, delta_he = a_he - b_he;
delta_he = delta_he*delta_he;
@@ -1064,8 +1063,8 @@ static void add_initial_gaschange(struct dive *dive, struct divecomputer *dc)
return;
/* Old starting gas mix */
- o2 = dive->cylinder[0].gasmix.o2.permille ? : O2_IN_AIR;
- he = dive->cylinder[0].gasmix.o2.permille;
+ o2 = get_o2(&dive->cylinder[0].gasmix);
+ he = get_he(&dive->cylinder[0].gasmix);
o2 = (o2 + 5) / 10;
he = (he + 5) / 10;
value = o2 + (he << 16);