From ee0fc25cf31050720f111266d39106d46306a21a Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 22 Oct 2018 12:42:09 +0200 Subject: 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 --- core/parse-xml.c | 6 ------ core/parse.c | 13 ------------- core/parse.h | 1 - 3 files changed, 20 deletions(-) diff --git a/core/parse-xml.c b/core/parse-xml.c index 5a6474b20..ec6d175c3 100644 --- a/core/parse-xml.c +++ b/core/parse-xml.c @@ -1520,11 +1520,6 @@ static void uddf_importer(void) xml_parsing_units.temperature = KELVIN; } -static void subsurface_webservice(void) -{ - import_source = SSRF_WS; -} - /* * I'm sure this could be done as some fancy DTD rules. * It's just not worth the headache. @@ -1557,7 +1552,6 @@ static struct nesting { /* Import type recognition */ { "Divinglog", DivingLog_importer }, { "uddf", uddf_importer }, - { "output", subsurface_webservice }, { NULL, } }; diff --git a/core/parse.c b/core/parse.c index 005a971e5..7135babb8 100644 --- a/core/parse.c +++ b/core/parse.c @@ -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 diff --git a/core/parse.h b/core/parse.h index 8575fd46a..bcdbe03c6 100644 --- a/core/parse.h +++ b/core/parse.h @@ -46,7 +46,6 @@ enum import_source { LIBDIVECOMPUTER, DIVINGLOG, UDDF, - SSRF_WS, } import_source; /* the dive table holds the overall dive list; target table points at -- cgit v1.2.3-70-g09d2