diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-10-23 12:42:01 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-10-29 00:09:31 +0000 |
commit | 68961a169efc37039cd3fda334efb9ad9927444f (patch) | |
tree | 19365422501eacee57b4cc71722a8a5d8a54f323 /core/datatrak.c | |
parent | 4cea7b49016923e3f9bb00b60976d7635907e038 (diff) | |
download | subsurface-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 'core/datatrak.c')
-rw-r--r-- | core/datatrak.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/datatrak.c b/core/datatrak.c index 582fb512f..dbc79534c 100644 --- a/core/datatrak.c +++ b/core/datatrak.c @@ -156,6 +156,7 @@ unsigned char *dt_dive_parser(unsigned char *runner, struct dive *dt_dive) *compl_buffer, *membuf = runner; char buffer[1024]; + struct dive_site *ds; device_data_t *devdata = calloc(1, sizeof(device_data_t)); /* @@ -200,7 +201,8 @@ unsigned char *dt_dive_parser(unsigned char *runner, struct dive *dt_dive) * Locality and Dive points. */ snprintf(buffer, sizeof(buffer), "%s, %s", locality, dive_point); - dt_dive->dive_site_uuid = get_dive_site_uuid_by_name(buffer, NULL); + ds = get_dive_site_by_name(buffer); + dt_dive->dive_site_uuid = ds ? ds->uuid : 0; if (dt_dive->dive_site_uuid == 0) dt_dive->dive_site_uuid = create_dive_site(buffer, dt_dive->when); free(locality); |