summaryrefslogtreecommitdiffstats
path: root/core/divelist.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-10-10 21:41:36 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-10-16 14:26:37 -0700
commit8549f24c915b05e0e84e73d3d99e7888d3c7c063 (patch)
treeb5696fb7675b448b9f812af79a8492d4ace318b4 /core/divelist.c
parent7b06349be55935be9a09310a5c0bba50e4585d35 (diff)
downloadsubsurface-8549f24c915b05e0e84e73d3d99e7888d3c7c063.tar.gz
core: add device_table parameter to device table functions
Instead of accessing the global device table directly, add a parameter to all device-table accessing functions. This makes all places in the code that access the global device table grep-able, which is necessary to include the device-table code in the undo system. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/divelist.c')
-rw-r--r--core/divelist.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/core/divelist.c b/core/divelist.c
index b1e670e31..c76ec7b25 100644
--- a/core/divelist.c
+++ b/core/divelist.c
@@ -826,7 +826,7 @@ void process_loaded_dives()
for_each_dive(i, dive) {
if (!dive->hidden_by_filter)
shown_dives++;
- set_dc_nickname(dive);
+ set_dc_nickname(dive, &device_table);
}
sort_dive_table(&dive_table);
@@ -1161,12 +1161,13 @@ void process_imported_dives(struct dive_table *import_table, struct trip_table *
/* 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 (flags & IMPORT_IS_DOWNLOADED)
- set_dc_nickname(import_table->dives[0]);
- else
+ if (flags & IMPORT_IS_DOWNLOADED) {
+ set_dc_nickname(import_table->dives[0], &device_table);
+ } else {
/* they aren't downloaded, so record / check all new ones */
for (i = 0; i < import_table->nr; i++)
- set_dc_nickname(import_table->dives[i]);
+ set_dc_nickname(import_table->dives[i], &device_table);
+ }
/* Sort the table of dives to be imported and combine mergable dives */
sort_dive_table(import_table);
@@ -1375,7 +1376,7 @@ void clear_dive_file_data()
}
clear_dive(&displayed_dive);
- clear_device_nodes();
+ clear_device_nodes(&device_table);
clear_events();
clear_filter_presets();