summaryrefslogtreecommitdiffstats
path: root/core/uemis-downloader.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-10-23 12:48:33 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-29 00:09:31 +0000
commitae6239bfec75df8a6795c2cc0017fcb0148e01e5 (patch)
tree3684db9af9409f65da3db53769529b4b108ae585 /core/uemis-downloader.c
parent68961a169efc37039cd3fda334efb9ad9927444f (diff)
downloadsubsurface-ae6239bfec75df8a6795c2cc0017fcb0148e01e5.tar.gz
Dive site: remove uuid in Uemis' divesite-map
The uemis downloader uses a cache for location to divesite id. Trivially, the divesite-uuid can be replaced by a pointer. This is a tiny step to remove divesite UUIDs. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/uemis-downloader.c')
-rw-r--r--core/uemis-downloader.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/uemis-downloader.c b/core/uemis-downloader.c
index d80201fb5..9f4936edb 100644
--- a/core/uemis-downloader.c
+++ b/core/uemis-downloader.c
@@ -79,7 +79,7 @@ static uint32_t mindiveid;
/* Linked list to remember already executed divespot download requests */
struct divespot_mapping {
int divespot_id;
- uint32_t dive_site_uuid;
+ struct dive_site *dive_site;
struct divespot_mapping *next;
};
static struct divespot_mapping *divespot_mapping = NULL;
@@ -95,7 +95,7 @@ static void erase_divespot_mapping()
divespot_mapping = NULL;
}
-static void add_to_divespot_mapping(int divespot_id, uint32_t dive_site_uuid)
+static void add_to_divespot_mapping(int divespot_id, struct dive_site *ds)
{
struct divespot_mapping *ndm = (struct divespot_mapping*)calloc(1, sizeof(struct divespot_mapping));
struct divespot_mapping **pdm = &divespot_mapping;
@@ -105,7 +105,7 @@ static void add_to_divespot_mapping(int divespot_id, uint32_t dive_site_uuid)
cdm = cdm->next;
ndm->divespot_id = divespot_id;
- ndm->dive_site_uuid = dive_site_uuid;
+ ndm->dive_site = ds;
ndm->next = NULL;
if (cdm)
cdm->next = ndm;
@@ -129,7 +129,7 @@ static struct dive_site *get_dive_site_by_divespot_id(int divespot_id)
struct divespot_mapping *dm = divespot_mapping;
while (dm) {
if (dm->divespot_id == divespot_id)
- return get_dive_site_by_uuid(dm->dive_site_uuid);
+ return dm->dive_site;
dm = dm->next;
}
return NULL;
@@ -1197,7 +1197,7 @@ static void get_uemis_divespot(const char *mountpath, int divespot_id, struct di
dive->dive_site_uuid = ods->uuid;
}
}
- add_to_divespot_mapping(divespot_id, dive->dive_site_uuid);
+ add_to_divespot_mapping(divespot_id, get_dive_site_by_uuid(dive->dive_site_uuid));
} else {
/* if we can't load the dive site details, delete the site we
* created in process_raw_buffer