diff options
author | Tomaz Canabrava <tomaz.canabrava@gmail.com> | 2015-06-01 23:13:51 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-06-01 21:36:48 -0700 |
commit | 6cd85d9b731ef646b605d483dbbcddbc70283338 (patch) | |
tree | acb08cd7f45fbcf375a7f41525fb102ebd9fdbd0 /divelist.c | |
parent | ee9746c622e84ed8385c8bbd0e6ffa61f4c813a4 (diff) | |
download | subsurface-6cd85d9b731ef646b605d483dbbcddbc70283338.tar.gz |
Simplify model handling and crashes fixes
So, there's only one crash left (that I put a big TODO: on the maintab.cpp
about) and I'll fix it tomorrow as it's quite late here and I'm almost
sleeping at the keyboard.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.c')
-rw-r--r-- | divelist.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/divelist.c b/divelist.c index d57188a68..773f52713 100644 --- a/divelist.c +++ b/divelist.c @@ -341,6 +341,19 @@ int get_divenr(struct dive *dive) return -1; } +int get_divesite_idx(struct dive_site *ds) +{ + int i; + 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; +} + static struct gasmix air = { .o2.permille = O2_IN_AIR, .he.permille = 0 }; /* take into account previous dives until there is a 48h gap between dives */ |