diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-02-26 22:26:11 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-04-12 18:19:07 +0300 |
commit | f6e7bdc5ef99d5a5fe71ac4f32511900fa82e804 (patch) | |
tree | 398efefad3b84b33eb5e488bdfa5b2482f345cdd /core/load-git.c | |
parent | 36644dc9f7540886801bda6131dff36241d9e879 (diff) | |
download | subsurface-f6e7bdc5ef99d5a5fe71ac4f32511900fa82e804.tar.gz |
Dive site: add dive site table parameter to dive site functions
To enable undo of dive site functions, it is crucial to work
with different dive site tables. Therefore add a dive site table
parameter to dive site functions. For now, always pass the global
dive site table. Thus, this commit shouldn't alter any functionality.
After this change, a simple search for dive_site_table reveals all
places where the global dive site table is accessed.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/load-git.c')
-rw-r--r-- | core/load-git.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/load-git.c b/core/load-git.c index 28b33f036..be8a839da 100644 --- a/core/load-git.c +++ b/core/load-git.c @@ -157,9 +157,9 @@ static void parse_dive_gps(char *line, struct membuffer *str, void *_dive) parse_location(line, &location); if (!ds) { - ds = get_dive_site_by_gps(&location); + ds = get_dive_site_by_gps(&location, &dive_site_table); if (!ds) - dive->dive_site = create_dive_site_with_gps("", &location, dive->when); + dive->dive_site = create_dive_site_with_gps("", &location, dive->when, &dive_site_table); else dive->dive_site = ds; } else { @@ -181,9 +181,9 @@ static void parse_dive_location(char *line, struct membuffer *str, void *_dive) struct dive *dive = _dive; struct dive_site *ds = get_dive_site_for_dive(dive); if (!ds) { - ds = get_dive_site_by_name(name); + ds = get_dive_site_by_name(name, &dive_site_table); if (!ds) - dive->dive_site = create_dive_site(name, dive->when); + dive->dive_site = create_dive_site(name, dive->when, &dive_site_table); else dive->dive_site = ds; } else { @@ -212,7 +212,7 @@ static void parse_dive_notes(char *line, struct membuffer *str, void *_dive) { UNUSED(line); struct dive *dive = _dive; dive->notes = get_utf8(str); } static void parse_dive_divesiteid(char *line, struct membuffer *str, void *_dive) -{ UNUSED(str); struct dive *dive = _dive; dive->dive_site = get_dive_site_by_uuid(get_hex(line)); } +{ UNUSED(str); struct dive *dive = _dive; dive->dive_site = get_dive_site_by_uuid(get_hex(line), &dive_site_table); } /* * We can have multiple tags in the membuffer. They are separated by @@ -1504,7 +1504,7 @@ static int parse_site_entry(git_repository *repo, const git_tree_entry *entry, c if (*suffix == '\0') return report_error("Dive site without uuid"); uint32_t uuid = strtoul(suffix, NULL, 16); - struct dive_site *ds = alloc_or_get_dive_site(uuid); + struct dive_site *ds = alloc_or_get_dive_site(uuid, &dive_site_table); git_blob *blob = git_tree_entry_blob(repo, entry); if (!blob) return report_error("Unable to read dive site file"); |