aboutsummaryrefslogtreecommitdiffstats
path: root/core/divesite.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-02-26 21:14:48 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-02-28 07:27:10 -0800
commit3c2dd7f7c6144a9b586269fcae35fe58a38f037d (patch)
treefd0c9430625d6b314a69c5170b0b2de3e9df956d /core/divesite.c
parent9c87c0dafd5d9946261787bcbb2e6311b5e5f444 (diff)
downloadsubsurface-3c2dd7f7c6144a9b586269fcae35fe58a38f037d.tar.gz
Cleanup: move get_divesite_idx() to divesite.c
This function was defined in divelist.c, whereas it's better located in divesite.c. Move it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/divesite.c')
-rw-r--r--core/divesite.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/divesite.c b/core/divesite.c
index a04d69f23..1ee399168 100644
--- a/core/divesite.c
+++ b/core/divesite.c
@@ -10,6 +10,19 @@
struct dive_site_table dive_site_table;
+int get_divesite_idx(const struct dive_site *ds)
+{
+ int i;
+ const struct dive_site *d;
+ // tempting as it may be, don't die when called with dive=NULL
+ if (ds)
+ for_each_dive_site(i, d) {
+ if (d->uuid == ds->uuid) // don't compare pointers, we could be passing in a copy of the dive
+ return i;
+ }
+ return -1;
+}
+
struct dive_site *get_dive_site_by_uuid(uint32_t uuid)
{
int i;