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:
Michael Keller 2023-10-18 21:55:39 +13:00 committed by bstoeger
parent 8d3f2e4ca6
commit 07a028b14d

View file

@ -49,15 +49,10 @@ void get_dive_gas(const struct dive *dive, int *o2_p, int *he_p, int *o2max_p)
maxo2 = o2;
if (o2 < mino2 && maxhe <= 0)
mino2 = o2;
if (he > maxhe)
goto newmax;
if (he < maxhe)
continue;
if (o2 <= maxo2)
continue;
newmax:
maxhe = he;
mino2 = o2;
if (he > maxhe) {
maxhe = he;
mino2 = o2;
}
}
/* All air? Show/sort as "air"/zero */
if ((!maxhe && maxo2 == O2_IN_AIR && mino2 == maxo2) ||