summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2019-06-24 16:52:06 +0800
committerGravatar bstoeger <32835590+bstoeger@users.noreply.github.com>2019-06-24 13:01:25 +0200
commitbc4c8d7d7484b0cd9672660869238899246159c1 (patch)
tree7df9719e2f87bf456642b618f7336db797aae953
parentd0df6a0073c8cc01cfd84489a37328d5df0ed18f (diff)
downloadsubsurface-bc4c8d7d7484b0cd9672660869238899246159c1.tar.gz
Desktop: small optimization
This way we don't need to iteratively grow the QVector. Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--desktop-widgets/command_divesite.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/desktop-widgets/command_divesite.cpp b/desktop-widgets/command_divesite.cpp
index eb03ed4d5..8c31959eb 100644
--- a/desktop-widgets/command_divesite.cpp
+++ b/desktop-widgets/command_divesite.cpp
@@ -190,6 +190,7 @@ static void swap(char *&c, QString &q)
static QVector<dive *> getDivesForSite(struct dive_site *ds)
{
QVector<dive *> diveSiteDives;
+ diveSiteDives.reserve(ds->dives.nr);
for (int i = 0; i < ds->dives.nr; ++i)
diveSiteDives.push_back(ds->dives.dives[i]);