summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-21 20:00:20 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-21 20:58:47 -0800
commit8d2abc05f60cb9a5ec79db9a215fe8aa97e0c311 (patch)
tree1a3d4fe6f9abc3206cdf8a115edb954842e64e29 /main.c
parenteb3e879030b0a29cc3f40d8df3e3eb6f7120c9ea (diff)
downloadsubsurface-8d2abc05f60cb9a5ec79db9a215fe8aa97e0c311.tar.gz
Remove nickname from divecomputer data structure
Having it there with the model information seemed to make sense but on second thought it's the wrong spot to keep that information, especially since we were storing it in the XML file in every single dive. This change removes the nickname member from the divecomputer and makes the rest of the code reasonably self consistent. It does not add much of the new code for the new design to handle nicknames. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'main.c')
-rw-r--r--main.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/main.c b/main.c
index 44373faf6..465cded78 100644
--- a/main.c
+++ b/main.c
@@ -124,15 +124,11 @@ void report_dives(gboolean is_imported, gboolean prefer_imported)
int preexisting = dive_table.preexisting;
struct dive *last;
- /* set the nickname for the divecomputer for newly downloaded dives */
- for (i = dive_table.preexisting; i < dive_table.nr; i++)
- if (dive_table.dives[i]->downloaded) {
- set_dc_nickname(dive_table.dives[i]);
- } else {
- struct divecomputer *dc = &dive_table.dives[i]->dc;
- if (dc->nickname && *dc->nickname)
- remember_dc(dc->deviceid, dc->nickname, TRUE);
- }
+ /* 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 (preexisting < dive_table.nr && dive_table.dives[preexisting]->downloaded)
+ set_dc_nickname(dive_table.dives[preexisting]);
/* This does the right thing for -1: NULL */
last = get_dive(preexisting-1);