Dive site: return pointer to dive_site in create_dive_site_*()

This changes more of the dive-site interface to return pointers
instead of UUIDs. Currently, most call sites directly extract
UUIDs afterwards. Ultimately, the UUIDs will be generally replaced
by pointers, which will then simplify these callers.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-10-23 13:29:04 +02:00 committed by Dirk Hohndel
parent ae6239bfec
commit d3a7c5448f
16 changed files with 35 additions and 36 deletions

View file

@ -435,8 +435,8 @@ void add_dive_site(char *ds_name, struct dive *dive, struct parser_state *state)
if (exact_match) {
dive->dive_site_uuid = exact_match->uuid;
} else {
dive->dive_site_uuid = create_dive_site(buffer, dive->when);
struct dive_site *newds = get_dive_site_by_uuid(dive->dive_site_uuid);
struct dive_site *newds = create_dive_site(buffer, dive->when);
dive->dive_site_uuid = newds->uuid;
if (has_location(&state->cur_location)) {
// we started this uuid with GPS data, so lets use those
newds->location = state->cur_location;
@ -450,7 +450,7 @@ void add_dive_site(char *ds_name, struct dive *dive, struct parser_state *state)
dive->dive_site_uuid = ds->uuid;
}
} else {
dive->dive_site_uuid = create_dive_site(buffer, dive->when);
dive->dive_site_uuid = create_dive_site(buffer, dive->when)->uuid;
}
}
free(to_free);