Parser: remove webservice related code

Recently, the subsurface webservice was removed. Remove the corresponding
code in the parser. This removes a static variable, which was used
to generate unique dive-site ids.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-10-22 12:42:09 +02:00 committed by Dirk Hohndel
parent 9c6d24e50e
commit ee0fc25cf3
3 changed files with 0 additions and 20 deletions

View file

@ -411,7 +411,6 @@ void utf8_string(char *buffer, void *_res)
void add_dive_site(char *ds_name, struct dive *dive)
{
static int suffix = 1;
char *buffer = ds_name;
char *to_free = NULL;
int size = trimspace(buffer);
@ -426,18 +425,6 @@ void add_dive_site(char *ds_name, struct dive *dive)
if (!uuid) {
// if the dive doesn't have a uuid, check if there's already a dive site by this name
uuid = get_dive_site_uuid_by_name(buffer, &ds);
if (uuid && import_source == SSRF_WS) {
// when downloading GPS fixes from the Subsurface webservice we will often
// get a lot of dives with identical names (the autogenerated fixes).
// So in this case modify the name to make it unique
int name_size = strlen(buffer) + 10; // 8 digits - enough for 100 million sites
to_free = buffer = malloc(name_size);
do {
suffix++;
snprintf(buffer, name_size, "%s %8d", ds_name, suffix);
} while (get_dive_site_uuid_by_name(buffer, NULL) != 0);
ds = NULL;
}
}
if (ds) {
// we have a uuid, let's hope there isn't a different name