diff options
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); } |