diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-02-28 22:45:17 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-04-12 18:19:07 +0300 |
commit | 37146c5742503becf75468fb07aab56011cb9101 (patch) | |
tree | 666e4d609b3d9b882082fcc258d6d153c6c68fa5 /core/parse.c | |
parent | 926b6895bbce7cc539ca4d0c3a425876dfa33d6b (diff) | |
download | subsurface-37146c5742503becf75468fb07aab56011cb9101.tar.gz |
Parser: parse into custom dive site table
To extend the undo system to dive sites, the importers and downloaders
must not parse directly into the global dive site table. Instead,
pass a dive_site_table argument to parse into.
For now, always pass the global dive_site_table so that this commit
should not cause any functional change.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/parse.c')
-rw-r--r-- | core/parse.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/parse.c b/core/parse.c index ba12cfddc..2763628f9 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, &dive_site_table); + struct dive_site *ds = alloc_or_get_dive_site(state->cur_dive_site->uuid, state->sites); 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, &dive_site_table); + ds = get_dive_site_by_name(buffer, state->sites); } 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, &dive_site_table); + struct dive_site *exact_match = get_dive_site_by_gps_and_name(buffer, &ds->location, state->sites); if (exact_match) { dive->dive_site = exact_match; } else { - struct dive_site *newds = create_dive_site(buffer, dive->when, &dive_site_table); + struct dive_site *newds = create_dive_site(buffer, dive->when, state->sites); 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_site_table); + dive->dive_site = create_dive_site(buffer, dive->when, state->sites); } } free(to_free); |