diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-10-03 21:45:50 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-10-06 19:47:06 -0700 |
commit | 6dc1dcaea52e383803a620369567684f553ede80 (patch) | |
tree | acde1a3bd6e60445f1e8dcbe2aa5283d3573ca50 /core | |
parent | e5dca8228e6b60cac5957726700c66d0565c064e (diff) | |
download | subsurface-6dc1dcaea52e383803a620369567684f553ede80.tar.gz |
Import: pass "downloaded" parameter to process_imported_dives()
process_imported_dives() is more efficient for downloaded than for
imported (from a file) dives, because it checks only the divecomputer
of the first dive.
This condition is checked via the "downloaded" flag of the first
dive. Instead, pass an argument to process_imported_dives().
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core')
-rw-r--r-- | core/divelist.c | 7 | ||||
-rw-r--r-- | core/divelist.h | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/core/divelist.c b/core/divelist.c index 71556101c..916da4605 100644 --- a/core/divelist.c +++ b/core/divelist.c @@ -1339,10 +1339,13 @@ static bool try_to_merge_into(struct dive *dive_to_add, int idx, bool prefer_imp * Add imported dive to global dive table. Overlapping dives will * be merged if possible. If prefer_imported is true, data of the * new dives are prioritized in such a case. + * If downloaded is true, only the divecomputer of the first dive + * will be considered, as it is assumed that all dives come from + * the same computer. * Note: the dives in import_table are consumed! On return import_table * has size 0. */ -void process_imported_dives(struct dive_table *import_table, bool prefer_imported) +void process_imported_dives(struct dive_table *import_table, bool prefer_imported, bool downloaded) { int i, j; struct dive *old_dive, *merged; @@ -1356,7 +1359,7 @@ void process_imported_dives(struct dive_table *import_table, bool prefer_importe /* check if we need a nickname for the divecomputer for newly downloaded dives; * since we know they all came from the same divecomputer we just check for the * first one */ - if (import_table->dives[0]->downloaded) + if (downloaded) set_dc_nickname(import_table->dives[0]); else /* they aren't downloaded, so record / check all new ones */ diff --git a/core/divelist.h b/core/divelist.h index 885dbe67f..ac9435356 100644 --- a/core/divelist.h +++ b/core/divelist.h @@ -19,7 +19,7 @@ extern int init_decompression(struct deco_state *ds, struct dive *dive); /* divelist core logic functions */ extern void process_loaded_dives(); -extern void process_imported_dives(struct dive_table *import_table, bool prefer_imported); +extern void process_imported_dives(struct dive_table *import_table, bool prefer_imported, bool downloaded); extern char *get_dive_gas_string(struct dive *dive); struct dive **grow_dive_table(struct dive_table *table); |