summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2017-05-12 17:24:56 +1000
committer Vas Crabb <vas@vastheman.com>2017-05-12 17:24:56 +1000
commite88b5e4f9dffb4ebf1e7ffbf5b42579d2d700d91 (patch)
tree869e674fe090cf5e8108a5ea7642c98c03e3fb21 /src/lib/util
parentcce57b37b55a95b3e91f77838999e0efa556b352 (diff)
Revert "Bug fix to -romident and aux verb cleanup (#2288)"
This reverts commit 78bf804192f38d69fc9299dc7da724fb6a537f94.
Diffstat (limited to 'src/lib/util')
-rw-r--r--src/lib/util/options.cpp42
-rw-r--r--src/lib/util/options.h2
2 files changed, 11 insertions, 33 deletions
diff --git a/src/lib/util/options.cpp b/src/lib/util/options.cpp
index d48268839c2..af172d7a94b 100644
--- a/src/lib/util/options.cpp
+++ b/src/lib/util/options.cpp
@@ -44,26 +44,6 @@ const char *const core_options::s_option_unadorned[MAX_UNADORNED_OPTIONS] =
};
-//**************************************************************************
-// UTILITY
-//**************************************************************************
-
-namespace
-{
- void trim_spaces_and_quotes(std::string &data)
- {
- // trim any whitespace
- strtrimspace(data);
-
- // trim quotes
- if (data.find_first_of('"') == 0 && data.find_last_of('"') == data.length() - 1)
- {
- data.erase(0, 1);
- data.erase(data.length() - 1, 1);
- }
- }
-};
-
//**************************************************************************
// CORE OPTIONS ENTRY
@@ -373,14 +353,6 @@ bool core_options::parse_command_line(std::vector<std::string> &args, int priori
bool is_unadorned = (curarg[0] != '-');
const char *optionname = is_unadorned ? core_options::unadorned(unadorned_index++) : &curarg[1];
- // special case - collect unadorned arguments after commands into a special place
- if (is_unadorned && !m_command.empty())
- {
- m_command_arguments.push_back(std::move(args[arg]));
- args[arg].clear();
- continue;
- }
-
// find our entry; if not found, continue
auto curentry = m_entrymap.find(optionname);
if (curentry == m_entrymap.end())
@@ -506,9 +478,7 @@ bool core_options::parse_ini_file(util::core_file &inifile, int priority, bool i
}
// set the new data
- std::string data = optiondata;
- trim_spaces_and_quotes(data);
- validate_and_set_data(*curentry->second, std::move(data), priority, error_string);
+ validate_and_set_data(*curentry->second, optiondata, priority, error_string);
}
return true;
}
@@ -862,6 +832,16 @@ void core_options::copyfrom(const core_options &src)
bool core_options::validate_and_set_data(core_options::entry &curentry, std::string &&data, int priority, std::string &error_string)
{
+ // trim any whitespace
+ strtrimspace(data);
+
+ // trim quotes
+ if (data.find_first_of('"') == 0 && data.find_last_of('"') == data.length() - 1)
+ {
+ data.erase(0, 1);
+ data.erase(data.length() - 1, 1);
+ }
+
// let derived classes override how we set this data
if (override_set_value(curentry.name(), data))
return true;
diff --git a/src/lib/util/options.h b/src/lib/util/options.h
index 231837aaf16..a2959a24a8f 100644
--- a/src/lib/util/options.h
+++ b/src/lib/util/options.h
@@ -129,7 +129,6 @@ public:
// getters
entry *first() const { return m_entrylist.first(); }
const std::string &command() const { return m_command; }
- const std::vector<std::string> &command_arguments() const { assert(!m_command.empty()); return m_command_arguments; }
entry *get_entry(const char *name) const;
// range iterators
@@ -202,7 +201,6 @@ private:
simple_list<entry> m_entrylist; // head of list of entries
std::unordered_map<std::string,entry *> m_entrymap; // map for fast lookup
std::string m_command; // command found
- std::vector<std::string> m_command_arguments; // command arguments
static const char *const s_option_unadorned[]; // array of unadorned option "names"
};