summaryrefslogtreecommitdiffstats
path: root/core/save-xml.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-10-26 17:03:54 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-29 00:09:31 +0000
commit724055f0af4fb7cdb9f1570967fe4b34797f3419 (patch)
tree6aab8c34e7d0a6df1d6fe84bc5794e8eb5404b7d /core/save-xml.c
parentacd44467c1100a1a774cc644921b1dc33dca1266 (diff)
downloadsubsurface-724055f0af4fb7cdb9f1570967fe4b34797f3419.tar.gz
Dive site: replace dive->dive_site_uuid by dive_site
Replace the UUID reference of struct dive by a pointer to dive_site. This commit is rather large in lines, but nevertheless quite simple since most of the UUID->pointer work was done in previous commits. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/save-xml.c')
-rw-r--r--core/save-xml.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/core/save-xml.c b/core/save-xml.c
index 7393b84cb..4a85053ab 100644
--- a/core/save-xml.c
+++ b/core/save-xml.c
@@ -483,11 +483,8 @@ void save_one_dive_to_mb(struct membuffer *b, struct dive *dive, bool anonymize)
if (dive->visibility)
put_format(b, " visibility='%d'", dive->visibility);
save_tags(b, dive->tag_list);
- if (dive->dive_site_uuid) {
- if (get_dive_site_by_uuid(dive->dive_site_uuid) != NULL)
- put_format(b, " divesiteid='%8x'", dive->dive_site_uuid);
- else if (verbose)
- fprintf(stderr, "removed reference to non-existant dive site with uuid %08x\n", dive->dive_site_uuid);
+ if (dive->dive_site) {
+ put_format(b, " divesiteid='%8x'", dive->dive_site->uuid);
}
show_date(b, dive->when);
if (dive->dc.duration.seconds > 0)
@@ -602,8 +599,8 @@ void save_dives_buffer(struct membuffer *b, const bool select_only, bool anonymi
struct dive_site *ds = get_dive_site(i);
if (dive_site_is_empty(ds) || !is_dive_site_used(ds, false)) {
for_each_dive(j, d) {
- if (d->dive_site_uuid == ds->uuid)
- d->dive_site_uuid = 0;
+ if (d->dive_site == ds)
+ d->dive_site = NULL;
}
delete_dive_site(ds);
i--; // since we just deleted that one