1
0
Fork 0
mirror of https://github.com/subsurface/subsurface.git synced 2025-02-19 22:16:15 +00:00

Cleanup: let get_dive_site_idx() compare pointers

The code used dive site uuids, which are not really used anymore.
The only caller of this function does certainly not use a copy,
so let's compare pointers instead.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-03-03 15:18:00 +01:00 committed by Dirk Hohndel
parent 82af1b2377
commit e1caae0111

View file

@ -14,10 +14,10 @@ int get_divesite_idx(const struct dive_site *ds, struct dive_site_table *ds_tabl
{
int i;
const struct dive_site *d;
// tempting as it may be, don't die when called with dive=NULL
// tempting as it may be, don't die when called with ds=NULL
if (ds)
for_each_dive_site(i, d, ds_table) {
if (d->uuid == ds->uuid) // don't compare pointers, we could be passing in a copy of the dive
if (d == ds)
return i;
}
return -1;