summaryrefslogtreecommitdiffstats
path: root/core/parse.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-02-26 22:26:11 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-04-12 18:19:07 +0300
commitf6e7bdc5ef99d5a5fe71ac4f32511900fa82e804 (patch)
tree398efefad3b84b33eb5e488bdfa5b2482f345cdd /core/parse.c
parent36644dc9f7540886801bda6131dff36241d9e879 (diff)
downloadsubsurface-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/parse.c')
-rw-r--r--core/parse.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/parse.c b/core/parse.c
index af1046014..ba12cfddc 100644
--- a/core/parse.c
+++ b/core/parse.c
@@ -225,7 +225,7 @@ void dive_site_end(struct parser_state *state)
state->cur_dive_site->taxonomy.category = NULL;
}
if (state->cur_dive_site->uuid) {
- struct dive_site *ds = alloc_or_get_dive_site(state->cur_dive_site->uuid);
+ struct dive_site *ds = alloc_or_get_dive_site(state->cur_dive_site->uuid, &dive_site_table);
merge_dive_site(ds, state->cur_dive_site);
if (verbose > 3)
@@ -419,7 +419,7 @@ void add_dive_site(char *ds_name, struct dive *dive, struct parser_state *state)
struct dive_site *ds = dive->dive_site;
if (!ds) {
// if the dive doesn't have a uuid, check if there's already a dive site by this name
- ds = get_dive_site_by_name(buffer);
+ ds = get_dive_site_by_name(buffer, &dive_site_table);
}
if (ds) {
// we have a uuid, let's hope there isn't a different name
@@ -430,11 +430,11 @@ void add_dive_site(char *ds_name, struct dive *dive, struct parser_state *state)
// but wait, we could have gotten this one based on GPS coords and could
// have had two different names for the same site... so let's search the other
// way around
- struct dive_site *exact_match = get_dive_site_by_gps_and_name(buffer, &ds->location);
+ struct dive_site *exact_match = get_dive_site_by_gps_and_name(buffer, &ds->location, &dive_site_table);
if (exact_match) {
dive->dive_site = exact_match;
} else {
- struct dive_site *newds = create_dive_site(buffer, dive->when);
+ struct dive_site *newds = create_dive_site(buffer, dive->when, &dive_site_table);
dive->dive_site = newds;
if (has_location(&state->cur_location)) {
// we started this uuid with GPS data, so lets use those
@@ -449,7 +449,7 @@ void add_dive_site(char *ds_name, struct dive *dive, struct parser_state *state)
dive->dive_site = ds;
}
} else {
- dive->dive_site = create_dive_site(buffer, dive->when);
+ dive->dive_site = create_dive_site(buffer, dive->when, &dive_site_table);
}
}
free(to_free);