Don't calculate what we already have

We already have the correct number of dive_sites, why use a loop to
calculate it?

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-05-31 17:47:34 -03:00 committed by Dirk Hohndel
parent b35e48c68e
commit 7129cef66f

View file

@ -33,17 +33,14 @@ QVariant LocationInformationModel::data(const QModelIndex &index, int role) cons
void LocationInformationModel::update()
{
int i;
struct dive_site *ds;
for_each_dive_site (i, ds);
if (rowCount()) {
beginRemoveRows(QModelIndex(), 0, rowCount()-1);
endRemoveRows();
}
if (i) {
beginInsertRows(QModelIndex(), 0, i-1);
internalRowCount = i-1;
if (dive_site_table.nr) {
beginInsertRows(QModelIndex(), 0, dive_site_table.nr);
internalRowCount = dive_site_table.nr;
endInsertRows();
}
}