Import: remove dive->downloaded logic

Dive importing is now performed via a distinct table which is
merged into the main dive table. Thus, it is known which of the
dive is new and which is old. This information can now be
implicitely encoded in the parameter-position of merge_dive()
[i.e. pass old as first and new as second dive].

This makes marking of downloaded dives via a flag unnecessary.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-10-03 21:32:28 +02:00 committed by Dirk Hohndel
parent ab14889563
commit e5dca8228e
2 changed files with 21 additions and 36 deletions

View file

@ -1367,9 +1367,6 @@ void process_imported_dives(struct dive_table *import_table, bool prefer_importe
sort_table(import_table);
merge_imported_dives(import_table);
for (i = 0; i < import_table->nr; i++)
import_table->dives[i]->downloaded = true;
/* Merge newly imported dives into the dive table.
* Since both lists (old and new) are sorted, we can step
* through them concurrently and locate the insertions points.
@ -1416,10 +1413,6 @@ void process_imported_dives(struct dive_table *import_table, bool prefer_importe
for ( ; i < import_table->nr; i++)
add_single_dive(dive_table.nr, import_table->dives[i]);
/* make sure no dives are still marked as downloaded */
for (i = 0; i < dive_table.nr; i++)
dive_table.dives[i]->downloaded = false;
/* we took care of all dives, clean up the import table */
import_table->nr = 0;