From bc4c8d7d7484b0cd9672660869238899246159c1 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 24 Jun 2019 16:52:06 +0800 Subject: [PATCH] Desktop: small optimization This way we don't need to iteratively grow the QVector. Suggested-by: Berthold Stoeger Signed-off-by: Dirk Hohndel --- desktop-widgets/command_divesite.cpp | 1 + 1 file changed, 1 insertion(+) 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 getDivesForSite(struct dive_site *ds) { QVector diveSiteDives; + diveSiteDives.reserve(ds->dives.nr); for (int i = 0; i < ds->dives.nr; ++i) diveSiteDives.push_back(ds->dives.dives[i]);