summaryrefslogtreecommitdiffstats
path: root/core/divesite.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-10-23 19:11:13 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-29 00:09:31 +0000
commitf527a70831a37e736431baa5705c9d188fc12f4b (patch)
tree5260e51c944b193175b9e318457bb281ee760fdf /core/divesite.c
parent8de471f90e95a5a75d0fec78d5bbf900eb90f235 (diff)
downloadsubsurface-f527a70831a37e736431baa5705c9d188fc12f4b.tar.gz
Dive site: pass dive-site pointer to delete_dive_site()
Instead of passing a uuid, pass a pointer to the dive site. This is small step in an effort to remove uuids. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/divesite.c')
-rw-r--r--core/divesite.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/core/divesite.c b/core/divesite.c
index 163ecc892..d20421de7 100644
--- a/core/divesite.c
+++ b/core/divesite.c
@@ -172,12 +172,11 @@ void free_dive_site(struct dive_site *ds)
}
}
-void delete_dive_site(uint32_t id)
+void delete_dive_site(struct dive_site *ds)
{
int nr = dive_site_table.nr;
for (int i = 0; i < nr; i++) {
- struct dive_site *ds = get_dive_site(i);
- if (ds->uuid == id) {
+ if (ds == get_dive_site(i)) {
free_dive_site(ds);
if (nr - 1 > i)
memmove(&dive_site_table.dive_sites[i],
@@ -329,7 +328,7 @@ void merge_dive_sites(uint32_t ref, uint32_t* uuids, int count)
for(i = 0; i < count; i++) {
if (uuids[i] == ref)
continue;
- delete_dive_site(uuids[i]);
+ delete_dive_site(get_dive_site_by_uuid(uuids[i]));
}
mark_divelist_changed(true);
}