Skip to content

Commit 3f7dc9b

Browse files
committed
refactor: Clean up long lines in settings code
Suggested by James O'Beirne <[email protected]> bitcoin/bitcoin#15934 (comment) This commit does not change behavior.
1 parent cd6cb97 commit 3f7dc9b

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

src/util/settings.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ SettingsValue GetSetting(const Settings& settings,
6868
// precedence over early settings, but for backwards compatibility in
6969
// the config file the precedence is reversed for all settings except
7070
// chain name settings.
71-
const bool reverse_precedence = (source == Source::CONFIG_FILE_NETWORK_SECTION || source == Source::CONFIG_FILE_DEFAULT_SECTION) && !get_chain_name;
71+
const bool reverse_precedence =
72+
(source == Source::CONFIG_FILE_NETWORK_SECTION || source == Source::CONFIG_FILE_DEFAULT_SECTION) &&
73+
!get_chain_name;
7274

7375
// Weird behavior preserved for backwards compatibility: Negated
7476
// -regtest and -testnet arguments which you would expect to override
@@ -78,7 +80,10 @@ SettingsValue GetSetting(const Settings& settings,
7880
const bool skip_negated_command_line = get_chain_name;
7981

8082
// Ignore settings in default config section if requested.
81-
if (ignore_default_section_config && source == Source::CONFIG_FILE_DEFAULT_SECTION && !never_ignore_negated_setting) return;
83+
if (ignore_default_section_config && source == Source::CONFIG_FILE_DEFAULT_SECTION &&
84+
!never_ignore_negated_setting) {
85+
return;
86+
}
8287

8388
// Skip negated command line settings.
8489
if (skip_negated_command_line && span.last_negated()) return;
@@ -111,7 +116,9 @@ std::vector<SettingsValue> GetSettingsList(const Settings& settings,
111116
// value is followed by non-negated value, in which case config file
112117
// settings will be brought back from the dead (but earlier command
113118
// line settings will still be ignored).
114-
const bool add_zombie_config_values = (source == Source::CONFIG_FILE_NETWORK_SECTION || source == Source::CONFIG_FILE_DEFAULT_SECTION) && !prev_negated_empty;
119+
const bool add_zombie_config_values =
120+
(source == Source::CONFIG_FILE_NETWORK_SECTION || source == Source::CONFIG_FILE_DEFAULT_SECTION) &&
121+
!prev_negated_empty;
115122

116123
// Ignore settings in default config section if requested.
117124
if (ignore_default_section_config && source == Source::CONFIG_FILE_DEFAULT_SECTION) return;

src/util/settings.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,18 @@ struct Settings {
4343
//! [section] keywords)
4444
//! @param get_chain_name - enable special backwards compatible behavior
4545
//! for GetChainName
46-
SettingsValue GetSetting(const Settings& settings, const std::string& section, const std::string& name, bool ignore_default_section_config, bool get_chain_name);
46+
SettingsValue GetSetting(const Settings& settings,
47+
const std::string& section,
48+
const std::string& name,
49+
bool ignore_default_section_config,
50+
bool get_chain_name);
4751

4852
//! Get combined setting value similar to GetSetting(), except if setting was
4953
//! specified multiple times, return a list of all the values specified.
50-
std::vector<SettingsValue> GetSettingsList(const Settings& settings, const std::string& section, const std::string& name, bool ignore_default_section_config);
54+
std::vector<SettingsValue> GetSettingsList(const Settings& settings,
55+
const std::string& section,
56+
const std::string& name,
57+
bool ignore_default_section_config);
5158

5259
//! Return true if a setting is set in the default config file section, and not
5360
//! overridden by a higher priority command-line or network section value.

0 commit comments

Comments
 (0)