summaryrefslogtreecommitdiffstats
path: root/core/taxonomy.c
diff options
context:
space:
mode:
authorGravatar Michael Werle <micha@michaelwerle.com>2020-09-03 12:04:05 +0900
committerGravatar bstoeger <32835590+bstoeger@users.noreply.github.com>2020-09-05 17:34:15 +0200
commitd404aa767feb24b19da50ba833723b3dd0cfb271 (patch)
treea6c3e4a0338854679e2c8f2e79bcac89e1244a76 /core/taxonomy.c
parent4f3b26f9b6296273e37ec317bc68f32f94f546dc (diff)
downloadsubsurface-d404aa767feb24b19da50ba833723b3dd0cfb271.tar.gz
[Bug #2934] Geo Lookup - support for remote dive sites
Some remote dive sites have no populated places (towns, cities) nearby. For such sites, we now fall back to looking up unpopulated place names, such as the reef or island name. Also some code refactorisation: the actual network access is now encapsulated in its own function removing some duplicated code handling in the reverseGeoLookup function and making it more readable. Furthermore, reverseGeoLookup() was completely refactored as most of its functionality was due to legacy requirements; the current code-base only calls this function from a single location and only with an empty taxonomy_data object. This makes the function more focussed and much simpler and more readable. Finally, a resource leak in reverseGeocde introduced in 4f3b26f9b6296273e37ec317bc68f32f94f546dc was fixed. Signed-off-by: Michael Werle <micha@michaelwerle.com>
Diffstat (limited to 'core/taxonomy.c')
-rw-r--r--core/taxonomy.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/taxonomy.c b/core/taxonomy.c
index 9592843f0..1747a78cf 100644
--- a/core/taxonomy.c
+++ b/core/taxonomy.c
@@ -42,7 +42,7 @@ void free_taxonomy(struct taxonomy_data *t)
}
}
-void copy_taxonomy(struct taxonomy_data *orig, struct taxonomy_data *copy)
+void copy_taxonomy(const struct taxonomy_data *orig, struct taxonomy_data *copy)
{
if (orig->category == NULL) {
free_taxonomy(copy);
@@ -63,7 +63,7 @@ void copy_taxonomy(struct taxonomy_data *orig, struct taxonomy_data *copy)
}
}
-int taxonomy_index_for_category(struct taxonomy_data *t, enum taxonomy_category cat)
+int taxonomy_index_for_category(const struct taxonomy_data *t, enum taxonomy_category cat)
{
for (int i = 0; i < t->nr; i++)
if (t->category[i].category == cat)