mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
8de471f90e
commit
f527a70831
8 changed files with 13 additions and 14 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue