From 07a028b14da1c9c19a5c0c57f317f97500c16550 Mon Sep 17 00:00:00 2001 From: Michael Keller Date: Wed, 18 Oct 2023 21:55:39 +1300 Subject: [PATCH] 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 --- core/divelist.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/core/divelist.c b/core/divelist.c index 8886d7ce2..ac0af1b18 100644 --- a/core/divelist.c +++ b/core/divelist.c @@ -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) ||