From 226161ee44b17469c83fb414f5a38f347af42417 Mon Sep 17 00:00:00 2001 From: Jan Mulder Date: Tue, 11 Sep 2018 14:39:25 +0200 Subject: cleanup[1/6]: do not set userid/save_userid_local from storage This the first of a set of cleanups related to the removal of 2 preferences: save_userid_local and userid. The commits are ordered so that a sane running state remains, should a bisect ever lands here. Here, just read a git or XML logbook including the to be removed preferences, as existing users can have this data sitting around. The only thing done here is not to store the possibly read data for the mentioned preferences. Signed-off-by: Jan Mulder --- core/load-git.c | 9 ++++----- core/parse-xml.c | 9 --------- core/parse.c | 6 ------ 3 files changed, 4 insertions(+), 20 deletions(-) (limited to 'core') diff --git a/core/load-git.c b/core/load-git.c index 235c0a4b1..66f4fd531 100644 --- a/core/load-git.c +++ b/core/load-git.c @@ -831,13 +831,13 @@ static void parse_settings_units(char *line, struct membuffer *str, void *unused } static void parse_settings_userid(char *line, struct membuffer *str, void *_unused) +/* Keep this despite removal of the webservice as there are legacy logbook around + * that still have this defined. + */ { UNUSED(str); UNUSED(_unused); - if (line) { - prefs.save_userid_local = true; - set_userid(line); - } + UNUSED(line); } static void parse_settings_prefs(char *line, struct membuffer *str, void *unused) @@ -1544,7 +1544,6 @@ static int parse_settings_entry(git_repository *repo, const git_tree_entry *entr git_blob *blob = git_tree_entry_blob(repo, entry); if (!blob) return report_error("Unable to read settings file"); - prefs.save_userid_local = false; for_each_line(blob, settings_parser, NULL); git_blob_free(blob); return 0; diff --git a/core/parse-xml.c b/core/parse-xml.c index 5e2dcaf56..865e9675e 100644 --- a/core/parse-xml.c +++ b/core/parse-xml.c @@ -944,13 +944,6 @@ static void try_to_fill_sample(struct sample *sample, const char *name, char *bu nonmatch("sample", name, buf); } -static void try_to_fill_userid(const char *name, char *buf) -{ - UNUSED(name); - if (prefs.save_userid_local) - set_userid(buf); -} - static const char *country, *city; static void divinglog_place(char *place, uint32_t *uuid) @@ -1382,7 +1375,6 @@ static bool entry(const char *name, char *buf) report_datafile_version(last_xml_version); } if (in_userid) { - try_to_fill_userid(name, buf); return true; } if (in_settings) { @@ -1643,7 +1635,6 @@ int parse_xml_buffer(const char *url, const char *buffer, int size, if (!doc) return report_error(translate("gettextFromC", "Failed to parse '%s'"), url); - prefs.save_userid_local = false; reset_all(); dive_start(); doc = test_xslt_transforms(doc, params); diff --git a/core/parse.c b/core/parse.c index 690b4d29a..46c041925 100644 --- a/core/parse.c +++ b/core/parse.c @@ -400,12 +400,6 @@ void divecomputer_end(void) void userid_start(void) { in_userid = true; - //if the xml contains userid, keep saving it. - // don't call the prefs method here as we don't wanna - // actually change the preferences, this is temporary and - // will be reverted when the file finishes. - - prefs.save_userid_local = true; } void userid_stop(void) -- cgit v1.2.3-70-g09d2