diff options
Diffstat (limited to 'core/dive.c')
-rw-r--r-- | core/dive.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/core/dive.c b/core/dive.c index 2b3b7ef62..5ddaded9e 100644 --- a/core/dive.c +++ b/core/dive.c @@ -4189,11 +4189,10 @@ struct dive *make_first_dc(const struct dive *d, int dc_number) return res; } -/* always acts on the current dive */ -unsigned int count_divecomputers(void) +int count_divecomputers(const struct dive *d) { int ret = 1; - struct divecomputer *dc = current_dive->dc.next; + struct divecomputer *dc = d->dc.next; while (dc) { ret++; dc = dc->next; @@ -4229,7 +4228,7 @@ static void delete_divecomputer(struct dive *d, int num) /* If this is the currently displayed dive, we might have to adjust * the currently displayed dive computer. */ - if (d == current_dive && dc_number >= count_divecomputers()) + if (d == current_dive && dc_number >= count_divecomputers(d)) dc_number--; invalidate_dive_cache(d); } |