From 3257dbfc630a1765411c5981218834069ffa6960 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Tue, 18 Jun 2024 21:05:36 +0200 Subject: [PATCH] cleanup: remove unused function get_dive_id_closest_to() The last caller was removed in e700920e8ef. Signed-off-by: Berthold Stoeger --- core/divelist.c | 26 -------------------------- core/divelist.h | 1 - 2 files changed, 27 deletions(-) diff --git a/core/divelist.c b/core/divelist.c index c6d1a7e31..e772c2d8e 100644 --- a/core/divelist.c +++ b/core/divelist.c @@ -1277,32 +1277,6 @@ void report_datafile_version(int version) min_datafile_version = version; } -int get_dive_id_closest_to(timestamp_t when) -{ - int i; - int nr = divelog.dives->nr; - - // deal with pathological cases - if (nr == 0) - return 0; - else if (nr == 1) - return divelog.dives->dives[0]->id; - - for (i = 0; i < nr && divelog.dives->dives[i]->when <= when; i++) - ; // nothing - - // again, capture the two edge cases first - if (i == nr) - return divelog.dives->dives[i - 1]->id; - else if (i == 0) - return divelog.dives->dives[0]->id; - - if (when - divelog.dives->dives[i - 1]->when < divelog.dives->dives[i]->when - when) - return divelog.dives->dives[i - 1]->id; - else - return divelog.dives->dives[i]->id; -} - void clear_dive_file_data() { fulltext_unregister_all(); diff --git a/core/divelist.h b/core/divelist.h index 4b07ebf3b..54b7d5444 100644 --- a/core/divelist.h +++ b/core/divelist.h @@ -57,7 +57,6 @@ extern int comp_dives(const struct dive *a, const struct dive *b); int get_min_datafile_version(); void reset_min_datafile_version(); void report_datafile_version(int version); -int get_dive_id_closest_to(timestamp_t when); void clear_dive_file_data(); void clear_dive_table(struct dive_table *table); void move_dive_table(struct dive_table *src, struct dive_table *dst);