From 694776eed1f88327237240e122e15b274a87994b Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 18 Oct 2020 21:45:50 +0200 Subject: cleanup: rename set_dc_nickname() to add_devices_of_dive() The function was misnamed in that it doesn't set the nickname of a device. Instead, it adds all (unknown) devices of a dive to the/a device-table. Let's call it appropriately. Signed-off-by: Berthold Stoeger --- core/device.cpp | 4 ++-- core/device.h | 2 +- core/divelist.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/device.cpp b/core/device.cpp index 3d3a476d9..bd1d75416 100644 --- a/core/device.cpp +++ b/core/device.cpp @@ -342,12 +342,12 @@ extern "C" int is_default_dive_computer_device(const char *name) return qPrefDiveComputer::device() == name; } -extern "C" void set_dc_nickname(struct dive *dive, struct device_table *device_table) +extern "C" void add_devices_of_dive(const struct dive *dive, struct device_table *device_table) { if (!dive) return; - struct divecomputer *dc; + const struct divecomputer *dc; for_each_dc (dive, dc) { if (!empty_string(dc->model) && dc->deviceid && diff --git a/core/device.h b/core/device.h index b5467ea09..0de299060 100644 --- a/core/device.h +++ b/core/device.h @@ -19,7 +19,7 @@ extern struct device_table device_table; extern void fake_dc(struct divecomputer *dc); extern void set_dc_deviceid(struct divecomputer *dc, unsigned int deviceid, const struct device_table *table); -extern void set_dc_nickname(struct dive *dive, struct device_table *table); +extern void add_devices_of_dive(const struct dive *dive, struct device_table *table); extern void create_device_node(struct device_table *table, const char *model, uint32_t deviceid, const char *serial, const char *firmware, const char *nickname); extern int nr_devices(const struct device_table *table); extern const struct device *get_device(const struct device_table *table, int i); diff --git a/core/divelist.c b/core/divelist.c index 3bc4ff229..2dd4e3e81 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, &device_table); + add_devices_of_dive(dive, &device_table); } sort_dive_table(&dive_table); @@ -1185,11 +1185,11 @@ void process_imported_dives(struct dive_table *import_table, struct trip_table * * 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], devices_to_add); + add_devices_of_dive(import_table->dives[0], devices_to_add); } 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], devices_to_add); + add_devices_of_dive(import_table->dives[i], devices_to_add); } /* Sort the table of dives to be imported and combine mergable dives */ -- cgit v1.2.3-70-g09d2