mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Desktop: Simplify the get_dive_gas() function.
Remove branches that are always taken or make no difference, as proposed in https://github.com/subsurface/subsurface/pull/3974#pullrequestreview-1674178375. Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
parent
8d3f2e4ca6
commit
07a028b14d
1 changed files with 4 additions and 9 deletions
|
@ -49,15 +49,10 @@ void get_dive_gas(const struct dive *dive, int *o2_p, int *he_p, int *o2max_p)
|
||||||
maxo2 = o2;
|
maxo2 = o2;
|
||||||
if (o2 < mino2 && maxhe <= 0)
|
if (o2 < mino2 && maxhe <= 0)
|
||||||
mino2 = o2;
|
mino2 = o2;
|
||||||
if (he > maxhe)
|
if (he > maxhe) {
|
||||||
goto newmax;
|
maxhe = he;
|
||||||
if (he < maxhe)
|
mino2 = o2;
|
||||||
continue;
|
}
|
||||||
if (o2 <= maxo2)
|
|
||||||
continue;
|
|
||||||
newmax:
|
|
||||||
maxhe = he;
|
|
||||||
mino2 = o2;
|
|
||||||
}
|
}
|
||||||
/* All air? Show/sort as "air"/zero */
|
/* All air? Show/sort as "air"/zero */
|
||||||
if ((!maxhe && maxo2 == O2_IN_AIR && mino2 == maxo2) ||
|
if ((!maxhe && maxo2 == O2_IN_AIR && mino2 == maxo2) ||
|
||||||
|
|
Loading…
Reference in a new issue