diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2019-04-03 23:05:44 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-04-12 12:59:17 +0300 |
commit | 36644dc9f7540886801bda6131dff36241d9e879 (patch) | |
tree | acd090b1cd50c3847fc817c3f675dc9965190e3c /desktop-widgets/tab-widgets/TabDiveStatistics.cpp | |
parent | 1f4777a2877e1df3215e03e48204333cb160a2c6 (diff) | |
download | subsurface-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/TabDiveStatistics.cpp')
-rw-r--r-- | desktop-widgets/tab-widgets/TabDiveStatistics.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/desktop-widgets/tab-widgets/TabDiveStatistics.cpp b/desktop-widgets/tab-widgets/TabDiveStatistics.cpp index dacb01721..0cf3befd2 100644 --- a/desktop-widgets/tab-widgets/TabDiveStatistics.cpp +++ b/desktop-widgets/tab-widgets/TabDiveStatistics.cpp @@ -97,10 +97,9 @@ void TabDiveStatistics::updateData() ui->timeLimits->setMinimum(""); } - QVector<QPair<QString, int> > gasUsed; + QVector<QPair<QString, int> > gasUsed = selectedDivesGasUsed(); QString gasUsedString; volume_t vol; - selectedDivesGasUsed(gasUsed); for (int j = 0; j < MAX_CYLINDERS; j++) { if (gasUsed.isEmpty()) break; |