summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tab-widgets/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Rolf Eike Beer <eike@sf-mail.de>2019-04-03 23:05:44 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-04-12 12:59:17 +0300
commit36644dc9f7540886801bda6131dff36241d9e879 (patch)
treeacd090b1cd50c3847fc817c3f675dc9965190e3c /desktop-widgets/tab-widgets/maintab.cpp
parent1f4777a2877e1df3215e03e48204333cb160a2c6 (diff)
downloadsubsurface-36644dc9f7540886801bda6131dff36241d9e879.tar.gz
optimize selectedDivesGasUsed()
-return the result instead of storing in a parameter, we now know that the list contains only those results that are generated in the function -allocate the result with the correct length right from the start -do not iterate over keys of a map and then do a map lookup to get the value but use an iterator that gives us both right from the start -remove one call alltogether as the results were not used there Signed-off-by: Rolf Eike Beer <eike@sf-mail.de>
Diffstat (limited to 'desktop-widgets/tab-widgets/maintab.cpp')
-rw-r--r--desktop-widgets/tab-widgets/maintab.cpp15
1 files changed, 0 insertions, 15 deletions
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp
index dbb83f356..d1f13dd13 100644
--- a/desktop-widgets/tab-widgets/maintab.cpp
+++ b/desktop-widgets/tab-widgets/maintab.cpp
@@ -542,21 +542,6 @@ void MainTab::updateDiveInfo(bool clear)
int mean[MAX_CYLINDERS], duration[MAX_CYLINDERS];
per_cylinder_mean_depth(&displayed_dive, select_dc(&displayed_dive), mean, duration);
- // now let's get some gas use statistics
- QVector<QPair<QString, int> > gasUsed;
- QString gasUsedString;
- volume_t vol;
- selectedDivesGasUsed(gasUsed);
- for (int j = 0; j < MAX_CYLINDERS; j++) {
- if (gasUsed.isEmpty())
- break;
- QPair<QString, int> gasPair = gasUsed.last();
- gasUsed.pop_back();
- vol.mliter = gasPair.second;
- gasUsedString.append(gasPair.first).append(": ").append(get_volume_string(vol, true)).append("\n");
- }
- if (!gasUsed.isEmpty())
- gasUsedString.append("...");
volume_t o2_tot = {}, he_tot = {};
selected_dives_gas_parts(&o2_tot, &he_tot);