summaryrefslogtreecommitdiffstats
path: root/smtk-import
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-10-23 12:42:01 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-29 00:09:31 +0000
commit68961a169efc37039cd3fda334efb9ad9927444f (patch)
tree19365422501eacee57b4cc71722a8a5d8a54f323 /smtk-import
parent4cea7b49016923e3f9bb00b60976d7635907e038 (diff)
downloadsubsurface-68961a169efc37039cd3fda334efb9ad9927444f.tar.gz
Dive site: return pointer to dive_site in get_dive_site_*()
As a first step in removing dive-site uuids, change the interface of the get_dive_site_*() functions to return pointers instead of uuids. This makes code a bit more complicated in places where the uuid is extracted afterwards (needed NULL check). Nevertheless, these places should disappear once pointers instead of uuids are stored in the dive-structures. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'smtk-import')
-rw-r--r--smtk-import/smartrak.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/smtk-import/smartrak.c b/smtk-import/smartrak.c
index fce89dbae..f787b401a 100644
--- a/smtk-import/smartrak.c
+++ b/smtk-import/smartrak.c
@@ -373,17 +373,19 @@ static void smtk_build_location(MdbHandle *mdb, char *idx, timestamp_t when, uin
str = smtk_concat_str(str, ", ", "%s", col[1]->bind_ptr); // Locality
str = smtk_concat_str(str, ", ", "%s", site);
- *location = get_dive_site_uuid_by_name(str, NULL);
- if (*location == 0) {
+ ds = get_dive_site_by_name(str);
+ if (!ds) {
if (!has_location(&loc))
*location = create_dive_site(str, when);
else
*location = create_dive_site_with_gps(str, &loc, when);
+ ds = get_dive_site_by_uuid(*location);
+ } else {
+ *location = ds->uuid;
}
smtk_free(bound_values, table->num_cols);
/* Insert site notes */
- ds = get_dive_site_by_uuid(*location);
ds->notes = copy_string(notes);
free(notes);