diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-02-13 23:22:40 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-02-13 23:22:40 -0800 |
commit | 6820b13bd58ee382a21215e84427dfd690857dd6 (patch) | |
tree | ff4bb030e3a15122a3fe3965b570e9246365e022 /save-git.c | |
parent | ca72ab574904bc7fe8083bb692f58d4647e2ff61 (diff) | |
download | subsurface-6820b13bd58ee382a21215e84427dfd690857dd6.tar.gz |
Don't store empty dive sites
And remove references to them from the dives.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'save-git.c')
-rw-r--r-- | save-git.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/save-git.c b/save-git.c index cf6bd37e9..84eb1a316 100644 --- a/save-git.c +++ b/save-git.c @@ -827,6 +827,17 @@ static void save_divesites(git_repository *repo, struct dir *tree) for (int i = 0; i < dive_site_table.nr; i++) { struct membuffer b = { 0 }; struct dive_site *ds = get_dive_site(i); + if (dive_site_is_empty(ds)) { + int j; + struct dive *d; + for_each_dive(j, d) { + if (d->dive_site_uuid == ds->uuid) + d->dive_site_uuid = 0; + } + delete_dive_site(get_dive_site(i)->uuid); + i--; // since we just deleted that one + continue; + } int size = sizeof("Site-012345678"); char name[size]; snprintf(name, size, "Site-%08x", ds->uuid); |