Add helper function that checks if a dive site is in use

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-07-15 21:25:26 -07:00
parent 542e04266d
commit 1dbb6071bd
3 changed files with 17 additions and 10 deletions

View file

@ -108,6 +108,20 @@ struct dive_site *alloc_dive_site()
return ds;
}
bool is_dive_site_used(uint32_t uuid, bool select_only)
{
int j;
bool found = false;
struct dive *d;
for_each_dive(j, d) {
if (d->dive_site_uuid == uuid && (!select_only || d->selected)) {
found = true;
break;
}
}
return found;
}
void delete_dive_site(uint32_t id)
{
int nr = dive_site_table.nr;