From 724055f0af4fb7cdb9f1570967fe4b34797f3419 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 26 Oct 2018 17:03:54 +0200 Subject: 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 --- core/save-git.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'core/save-git.c') diff --git a/core/save-git.c b/core/save-git.c index b118cff3d..413c66211 100644 --- a/core/save-git.c +++ b/core/save-git.c @@ -431,17 +431,15 @@ static void create_dive_buffer(struct dive *dive, struct membuffer *b) SAVE("visibility", visibility); cond_put_format(dive->tripflag == NO_TRIP, b, "notrip\n"); save_tags(b, dive->tag_list); - cond_put_format(dive->dive_site_uuid && get_dive_site_by_uuid(dive->dive_site_uuid), - b, "divesiteid %08x\n", dive->dive_site_uuid); - if (verbose && dive->dive_site_uuid && !get_dive_site_by_uuid(dive->dive_site_uuid)) - fprintf(stderr, "removed reference to non-existant dive site with uuid %08x\n", dive->dive_site_uuid); + cond_put_format(!!dive->dive_site, b, "divesiteid %08x\n", dive->dive_site->uuid); + if (verbose && dive->dive_site) + fprintf(stderr, "removed reference to non-existant dive site with uuid %08x\n", dive->dive_site->uuid); save_overview(b, dive); save_cylinder_info(b, dive); save_weightsystem_info(b, dive); save_dive_temperature(b, dive); } - /* * libgit2 has a "git_treebuilder" concept, but it's broken, and can not * be used to do a flat tree (like the git "index") nor a recursive tree. @@ -887,8 +885,8 @@ static void save_divesites(git_repository *repo, struct dir *tree) int j; struct dive *d; 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 -- cgit v1.2.3-70-g09d2