From 21d78121ade941adf9eaad399e6b8146298b421f Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 2 Oct 2017 23:03:44 -0700 Subject: Don't add separate country field, use taxonomy The more I looked at the code that added the country to the dive site, the more it seemed redundant given what we have with the taxonomy. Signed-off-by: Dirk Hohndel --- core/dive.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'core/dive.h') diff --git a/core/dive.h b/core/dive.h index a638cfd0c..51524500f 100644 --- a/core/dive.h +++ b/core/dive.h @@ -570,11 +570,14 @@ static inline struct dive_site *get_dive_site_for_dive(struct dive *dive) return NULL; } -static inline char *get_dive_country(struct dive *dive) +static inline const char *get_dive_country(struct dive *dive) { struct dive_site *ds = get_dive_site_by_uuid(dive->dive_site_uuid); - if (ds && ds->country) - return ds->country; + if (ds) { + int idx = taxonomy_index_for_category(&ds->taxonomy, TC_COUNTRY); + if (idx >= 0) + return ds->taxonomy.category[idx].value; + } return NULL; } -- cgit v1.2.3-70-g09d2