aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-12-24 10:18:56 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-24 07:24:11 -0800
commit1a933e7e19ba3ded1ab508dfb7ef4f19a1da4519 (patch)
tree7725eef30270b458cc6ad39f058a8356a06629df /qt-ui/diveplanner.cpp
parent5e446fd258e8ee200f2b8b19e86374add17b8287 (diff)
downloadsubsurface-1a933e7e19ba3ded1ab508dfb7ef4f19a1da4519.tar.gz
Don't use QList if sizeof(item) > void*.
QList is optimized for storing pointer-sized items, thus a QVector is the better choice for everything else. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r--qt-ui/diveplanner.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 303327d42..54db1ad7f 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -1323,9 +1323,9 @@ DivePlannerPointsModel::Mode DivePlannerPointsModel::currentMode() const
return mode;
}
-QList<QPair<int, int> > DivePlannerPointsModel::collectGases(struct dive *d)
+QVector<QPair<int, int> > DivePlannerPointsModel::collectGases(struct dive *d)
{
- QList<QPair<int, int> > l;
+ QVector<QPair<int, int> > l;
for (int i = 0; i < MAX_CYLINDERS; i++) {
cylinder_t *cyl = &d->cylinder[i];
if (!cylinder_nodata(cyl))
@@ -1357,10 +1357,10 @@ void DivePlannerPointsModel::tanksUpdated()
// "did a gas change on us". So we look through the diveplan to
// see if there is a gas that is now missing and if there is, we
// replace it with the matching new gas.
- QList<QPair<int,int> > gases = collectGases(stagingDive);
- if (gases.length() == oldGases.length()) {
+ QVector<QPair<int,int> > gases = collectGases(stagingDive);
+ if (gases.count() == oldGases.count()) {
// either nothing relevant changed, or exactly ONE gasmix changed
- for (int i = 0; i < gases.length(); i++) {
+ for (int i = 0; i < gases.count(); i++) {
if (gases.at(i) != oldGases.at(i)) {
if (oldGases.count(oldGases.at(i)) > 1) {
// we had this gas more than once, so don't