mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
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>
This commit is contained in:
parent
36657c019b
commit
53b805131e
2 changed files with 17 additions and 0 deletions
15
divesite.c
15
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->notes = copy_string(orig->notes);
|
||||||
copy->description = copy_string(orig->description);
|
copy->description = copy_string(orig->description);
|
||||||
copy->uuid = orig->uuid;
|
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)
|
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->latitude.udeg = 0;
|
||||||
ds->longitude.udeg = 0;
|
ds->longitude.udeg = 0;
|
||||||
ds->uuid = 0;
|
ds->uuid = 0;
|
||||||
|
ds->taxonomy.nr = 0;
|
||||||
|
free_taxonomy(ds->taxonomy.category);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define DIVESITE_H
|
#define DIVESITE_H
|
||||||
|
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
|
#include "taxonomy.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -17,6 +18,7 @@ struct dive_site
|
||||||
degrees_t latitude, longitude;
|
degrees_t latitude, longitude;
|
||||||
char *description;
|
char *description;
|
||||||
char *notes;
|
char *notes;
|
||||||
|
struct taxonomy_data taxonomy;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dive_site_table {
|
struct dive_site_table {
|
||||||
|
|
Loading…
Add table
Reference in a new issue