Skip to content

Commit 0fa5435

Browse files
committed
refactor: Add ArgsManager::GetSettingsList method
Add for consistency with ArgsManager::GetSetting method and to make setting types accessible to ArgsManager callers and tests (test added next commit). This commit does not change behavior.
1 parent 3e18552 commit 0fa5435

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/util/system.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,8 @@ Optional<unsigned int> ArgsManager::GetArgFlags(const std::string& name) const
352352

353353
std::vector<std::string> ArgsManager::GetArgs(const std::string& strArg) const
354354
{
355-
LOCK(cs_args);
356-
bool ignore_default_section_config = !UseDefaultSection(strArg);
357355
std::vector<std::string> result;
358-
for (const util::SettingsValue& value :
359-
util::GetSettingsList(m_settings, m_network, SettingName(strArg), ignore_default_section_config)) {
356+
for (const util::SettingsValue& value : GetSettingsList(strArg)) {
360357
result.push_back(value.isFalse() ? "0" : value.isTrue() ? "1" : value.get_str());
361358
}
362359
return result;
@@ -869,6 +866,12 @@ util::SettingsValue ArgsManager::GetSetting(const std::string& arg) const
869866
m_settings, m_network, SettingName(arg), !UseDefaultSection(arg), /* get_chain_name= */ false);
870867
}
871868

869+
std::vector<util::SettingsValue> ArgsManager::GetSettingsList(const std::string& arg) const
870+
{
871+
LOCK(cs_args);
872+
return util::GetSettingsList(m_settings, m_network, SettingName(arg), !UseDefaultSection(arg));
873+
}
874+
872875
bool RenameOver(fs::path src, fs::path dest)
873876
{
874877
#ifdef WIN32

src/util/system.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ class ArgsManager
180180
*/
181181
util::SettingsValue GetSetting(const std::string& arg) const;
182182

183+
/**
184+
* Get list of setting values.
185+
*/
186+
std::vector<util::SettingsValue> GetSettingsList(const std::string& arg) const;
187+
183188
public:
184189
ArgsManager();
185190

0 commit comments

Comments
 (0)