diff options
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -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); |