summaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlmanager.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-08-15 13:50:01 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-08-16 16:23:19 -0700
commit21d70cbeb1fa3cf30c79636db2fce941bb277d3d (patch)
tree2f952b612aa57f9171337b845be84b699fc61361 /mobile-widgets/qmlmanager.cpp
parent5299d8291de3b0ab2522ede6b1b7ee1e1f81f864 (diff)
downloadsubsurface-21d70cbeb1fa3cf30c79636db2fce941bb277d3d.tar.gz
mobile/cleanup: use local variable to simplify code
The old code wasn't wrong, and likely the compiler turned this into something that wasn't really terrible... but yeah, 5 unnecessary calls to a helper function just bugged me. And I think the new code is much easier to read. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qmlmanager.cpp')
-rw-r--r--mobile-widgets/qmlmanager.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 6e5357cdc..140a64777 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -1103,10 +1103,11 @@ void QMLManager::commitChanges(QString diveId, QString number, QString date, QSt
if (state != "add" && !is_cylinder_used(d, i))
continue;
- get_or_create_cylinder(d, i)->start.mbar = parsePressureToMbar(startpressure[j]);
- get_cylinder(d, i)->end.mbar = parsePressureToMbar(endpressure[j]);
- if (get_cylinder(d, i)->end.mbar > get_cylinder(d, i)->start.mbar)
- get_cylinder(d, i)->end.mbar = get_cylinder(d, i)->start.mbar;
+ cylinder_t *cyl = get_or_create_cylinder(d, i);
+ cyl->start.mbar = parsePressureToMbar(startpressure[j]);
+ cyl->end.mbar = parsePressureToMbar(endpressure[j]);
+ if (cyl->end.mbar > cyl->start.mbar)
+ cyl->end.mbar = cyl->start.mbar;
j++;
}