diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-07-01 12:28:15 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-07-01 12:28:15 -0700 |
commit | 53b805131edeea839dc0af9a51b9e953fc4fcabf (patch) | |
tree | 978d9558210745b16e8147acd391d50dee896d1d /divesite.c | |
parent | 36657c019be70be11430ce8e785dea3fb2e6a415 (diff) | |
download | subsurface-53b805131edeea839dc0af9a51b9e953fc4fcabf.tar.gz |
Geo taxonomy: add the taxonomy information to dive sites
Make the helper functions handle it as well
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divesite.c')
-rw-r--r-- | divesite.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/divesite.c b/divesite.c index 41d96de5d..cd8ee8a7d 100644 --- a/divesite.c +++ b/divesite.c @@ -169,6 +169,19 @@ void copy_dive_site(struct dive_site *orig, struct dive_site *copy) copy->notes = copy_string(orig->notes); copy->description = copy_string(orig->description); copy->uuid = orig->uuid; + copy->taxonomy.nr = orig->taxonomy.nr; + if (orig->taxonomy.category == NULL) { + free(copy->taxonomy.category); + copy->taxonomy.category = NULL; + } else { + if (copy->taxonomy.category == NULL) + copy->taxonomy.category = alloc_taxonomy(); + for (int i = 0; i < NR_CATEGORIES; i++) { + free((void *)copy->taxonomy.category[i].value); + copy->taxonomy.category[i] = orig->taxonomy.category[i]; + copy->taxonomy.category[i].value = copy_string(orig->taxonomy.category[i].value); + } + } } void clear_dive_site(struct dive_site *ds) @@ -182,4 +195,6 @@ void clear_dive_site(struct dive_site *ds) ds->latitude.udeg = 0; ds->longitude.udeg = 0; ds->uuid = 0; + ds->taxonomy.nr = 0; + free_taxonomy(ds->taxonomy.category); } |