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>
This commit is contained in:
Dirk Hohndel 2019-06-24 16:52:06 +08:00 committed by bstoeger
parent d0df6a0073
commit bc4c8d7d74

View file

@ -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]);