diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-03-05 22:58:47 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-04-12 18:19:07 +0300 |
commit | e2df38d868324f2a767d2109cdd8727acb866ca2 (patch) | |
tree | 614b560431d2c61f3f2b1e2f986c7806bd175ae9 /core/datatrak.c | |
parent | c22fd9f4fd6699333629b8acb1e9c135a9783082 (diff) | |
download | subsurface-e2df38d868324f2a767d2109cdd8727acb866ca2.tar.gz |
Dive site: add dive site ref-counting
Instead of setting dive->dive_site directly, call the
add_dive_to_dive_site() and unregister_dive_from_dive_site()
functions. In the parser this turned out to be a bit tricky.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/datatrak.c')
-rw-r--r-- | core/datatrak.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/datatrak.c b/core/datatrak.c index 0f7886158..553f0da05 100644 --- a/core/datatrak.c +++ b/core/datatrak.c @@ -195,9 +195,9 @@ static unsigned char *dt_dive_parser(unsigned char *runner, struct dive *dt_dive */ snprintf(buffer, sizeof(buffer), "%s, %s", locality, dive_point); ds = get_dive_site_by_name(buffer, sites); - dt_dive->dive_site = ds; - if (!dt_dive->dive_site) - dt_dive->dive_site = create_dive_site(buffer, sites); + if (!ds) + ds = create_dive_site(buffer, sites); + add_dive_to_dive_site(dt_dive, ds); free(locality); locality = NULL; free(dive_point); |