mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add taxonomy copy helper function
We don't want to just be able to copy all of a dive site. Sometimes we might want to be able to copy just the taxonomy. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
9fd6b3eefb
commit
de10fd4021
2 changed files with 16 additions and 13 deletions
|
@ -245,20 +245,8 @@ bool dive_site_is_empty(struct dive_site *ds)
|
|||
ds->longitude.udeg == 0;
|
||||
}
|
||||
|
||||
void copy_dive_site(struct dive_site *orig, struct dive_site *copy)
|
||||
void copy_dive_site_taxonomy(struct dive_site *orig, struct dive_site *copy)
|
||||
{
|
||||
free(copy->name);
|
||||
free(copy->notes);
|
||||
free(copy->country);
|
||||
free(copy->description);
|
||||
|
||||
copy->latitude = orig->latitude;
|
||||
copy->longitude = orig->longitude;
|
||||
copy->name = copy_string(orig->name);
|
||||
copy->notes = copy_string(orig->notes);
|
||||
copy->description = copy_string(orig->description);
|
||||
copy->country = copy_string(orig->country);
|
||||
copy->uuid = orig->uuid;
|
||||
if (orig->taxonomy.category == NULL) {
|
||||
free_taxonomy(©->taxonomy);
|
||||
} else {
|
||||
|
@ -275,6 +263,20 @@ void copy_dive_site(struct dive_site *orig, struct dive_site *copy)
|
|||
copy->taxonomy.nr = orig->taxonomy.nr;
|
||||
}
|
||||
}
|
||||
void copy_dive_site(struct dive_site *orig, struct dive_site *copy)
|
||||
{
|
||||
free(copy->name);
|
||||
free(copy->notes);
|
||||
free(copy->description);
|
||||
|
||||
copy->latitude = orig->latitude;
|
||||
copy->longitude = orig->longitude;
|
||||
copy->name = copy_string(orig->name);
|
||||
copy->notes = copy_string(orig->notes);
|
||||
copy->description = copy_string(orig->description);
|
||||
copy->uuid = orig->uuid;
|
||||
copy_dive_site_taxonomy(orig, copy);
|
||||
}
|
||||
|
||||
static void merge_string(char **a, char **b)
|
||||
{
|
||||
|
|
|
@ -65,6 +65,7 @@ uint32_t get_dive_site_uuid_by_gps(degrees_t latitude, degrees_t longitude, stru
|
|||
uint32_t get_dive_site_uuid_by_gps_and_name(char *name, degrees_t latitude, degrees_t longitude);
|
||||
uint32_t get_dive_site_uuid_by_gps_proximity(degrees_t latitude, degrees_t longitude, int distance, struct dive_site **dsp);
|
||||
bool dive_site_is_empty(struct dive_site *ds);
|
||||
void copy_dive_site_taxonomy(struct dive_site *orig, struct dive_site *copy);
|
||||
void copy_dive_site(struct dive_site *orig, struct dive_site *copy);
|
||||
void merge_dive_site(struct dive_site *a, struct dive_site *b);
|
||||
void clear_dive_site(struct dive_site *ds);
|
||||
|
|
Loading…
Add table
Reference in a new issue