diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-02-12 12:28:54 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-02-12 12:31:10 -0800 |
commit | 0ce215e0d90e8d7612917b75f73bb703b9ada9ae (patch) | |
tree | a6c844f8a635080cc972993df3a4a8c56a19e1f1 /divesite.c | |
parent | a6336d13b302d071bc94cc15b4a865f0ba2492f7 (diff) | |
download | subsurface-0ce215e0d90e8d7612917b75f73bb703b9ada9ae.tar.gz |
Fix dive site creation from v2 git storage
Clearly didn't test that part well enough.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divesite.c')
-rw-r--r-- | divesite.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/divesite.c b/divesite.c index c9dbb095a..d9351e1af 100644 --- a/divesite.c +++ b/divesite.c @@ -67,3 +67,17 @@ uint32_t dive_site_uuid_by_name(const char *name) return id; } + +/* if the uuid is valid, just get the site, otherwise create it first; + * so you can call this with dive->dive_site_uuid and you'll either get the existing + * dive site or it will create a new one - so make sure you assign the uuid back to + * dive->dive_site_uuid when using this function! */ +struct dive_site *get_or_create_dive_site_by_uuid(uint32_t uuid) +{ + struct dive_site *ds = get_dive_site_by_uuid(uuid); + + if (!ds) + ds = alloc_dive_site(); + + return ds; +} |