summaryrefslogtreecommitdiffstats
path: root/divesite.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-02 07:03:03 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-02 07:03:03 -0700
commitf554c2d16cb5816b6b1a97b0349488bc70b512b0 (patch)
tree60811b1d64c2f37378ed20147f829cf74849d1dd /divesite.c
parent1d59b028c91ab7943cfece4a113948c61110dfc3 (diff)
parent0a0a6f07d5dbb2c24184d22c3c2cedf89ffdc7ac (diff)
downloadsubsurface-f554c2d16cb5816b6b1a97b0349488bc70b512b0.tar.gz
Merge branch 'taxonomy'
Diffstat (limited to 'divesite.c')
-rw-r--r--divesite.c15
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);
}