diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2019-11-07 22:04:42 -0500 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2019-11-07 22:04:42 -0500 |
commit | 5a84aa880f6da0bac0e2144733fdef3b8558c761 (patch) | |
tree | ae4e658cfe66d5260a6e7810420446846d75bb3a /src/util/system.cpp | |
parent | dc8e1e75487461ec9bff433144f0db831b682403 (diff) |
Rename includeconf variables for clarity
includeconf -> conf_file_names
to_include -> conf_file_name
include_config -> conf_file_stream
Suggestion from John Newbery <john@johnnewbery.com> in
https://github.com/bitcoin/bitcoin/pull/15934#discussion_r343905138
Diffstat (limited to 'src/util/system.cpp')
-rw-r--r-- | src/util/system.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/util/system.cpp b/src/util/system.cpp index 9254004191..67c7694944 100644 --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -908,12 +908,12 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys) } if (use_conf_file) { std::string chain_id = GetChainName(); - std::vector<std::string> includeconf(GetArgs("-includeconf")); + std::vector<std::string> conf_file_names(GetArgs("-includeconf")); { // We haven't set m_network yet (that happens in SelectParams()), so manually check // for network.includeconf args. std::vector<std::string> includeconf_net(GetArgs(std::string("-") + chain_id + ".includeconf")); - includeconf.insert(includeconf.end(), includeconf_net.begin(), includeconf_net.end()); + conf_file_names.insert(conf_file_names.end(), includeconf_net.begin(), includeconf_net.end()); } // Remove -includeconf from configuration, so we can warn about recursion @@ -924,33 +924,33 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys) m_config_args.erase(std::string("-") + chain_id + ".includeconf"); } - for (const std::string& to_include : includeconf) { - fsbridge::ifstream include_config(GetConfigFile(to_include)); - if (include_config.good()) { - if (!ReadConfigStream(include_config, to_include, error, ignore_invalid_keys)) { + for (const std::string& conf_file_name : conf_file_names) { + fsbridge::ifstream conf_file_stream(GetConfigFile(conf_file_name)); + if (conf_file_stream.good()) { + if (!ReadConfigStream(conf_file_stream, conf_file_name, error, ignore_invalid_keys)) { return false; } - LogPrintf("Included configuration file %s\n", to_include); + LogPrintf("Included configuration file %s\n", conf_file_name); } else { - error = "Failed to include configuration file " + to_include; + error = "Failed to include configuration file " + conf_file_name; return false; } } // Warn about recursive -includeconf - includeconf = GetArgs("-includeconf"); + conf_file_names = GetArgs("-includeconf"); { std::vector<std::string> includeconf_net(GetArgs(std::string("-") + chain_id + ".includeconf")); - includeconf.insert(includeconf.end(), includeconf_net.begin(), includeconf_net.end()); + conf_file_names.insert(conf_file_names.end(), includeconf_net.begin(), includeconf_net.end()); std::string chain_id_final = GetChainName(); if (chain_id_final != chain_id) { // Also warn about recursive includeconf for the chain that was specified in one of the includeconfs includeconf_net = GetArgs(std::string("-") + chain_id_final + ".includeconf"); - includeconf.insert(includeconf.end(), includeconf_net.begin(), includeconf_net.end()); + conf_file_names.insert(conf_file_names.end(), includeconf_net.begin(), includeconf_net.end()); } } - for (const std::string& to_include : includeconf) { - tfm::format(std::cerr, "warning: -includeconf cannot be used from included files; ignoring -includeconf=%s\n", to_include); + for (const std::string& conf_file_name : conf_file_names) { + tfm::format(std::cerr, "warning: -includeconf cannot be used from included files; ignoring -includeconf=%s\n", conf_file_name); } } } |