Skip to content

Commit d056689

Browse files
committed
refactor: Avoid using IsArgSet() on -debug, -loglevel, and -vbparams list options
This commit does not change behavior, it just drops unnecessary IsArgSet() calls for -debug, -loglevel, and -vbparams options. The calls are unnecessary because GetArgs() already returns empty arrays if these arguments are not specified.
1 parent 3d1e8ca commit d056689

File tree

2 files changed

+0
-6
lines changed

2 files changed

+0
-6
lines changed

src/chainparams.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ void ReadRegTestArgs(const ArgsManager& args, CChainParams::RegTestOptions& opti
6666
}
6767
}
6868

69-
if (!args.IsArgSet("-vbparams")) return;
70-
7169
for (const std::string& strDeployment : args.GetArgs("-vbparams")) {
7270
std::vector<std::string> vDeploymentParams = SplitString(strDeployment, ':');
7371
if (vDeploymentParams.size() < 3 || 4 < vDeploymentParams.size()) {

src/init/common.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ void SetLoggingOptions(const ArgsManager& args)
5858

5959
util::Result<void> SetLoggingLevel(const ArgsManager& args)
6060
{
61-
if (args.IsArgSet("-loglevel")) {
6261
for (const std::string& level_str : args.GetArgs("-loglevel")) {
6362
if (level_str.find_first_of(':', 3) == std::string::npos) {
6463
// user passed a global log level, i.e. -loglevel=<level>
@@ -73,13 +72,11 @@ util::Result<void> SetLoggingLevel(const ArgsManager& args)
7372
}
7473
}
7574
}
76-
}
7775
return {};
7876
}
7977

8078
util::Result<void> SetLoggingCategories(const ArgsManager& args)
8179
{
82-
if (args.IsArgSet("-debug")) {
8380
const std::vector<std::string> categories = args.GetArgs("-debug");
8481

8582
// Special-case: Disregard any debugging categories appearing before -debug=0/none
@@ -93,7 +90,6 @@ util::Result<void> SetLoggingCategories(const ArgsManager& args)
9390
return util::Error{strprintf(_("Unsupported logging category %s=%s."), "-debug", cat)};
9491
}
9592
}
96-
}
9793

9894
// Now remove the logging categories which were explicitly excluded
9995
for (const std::string& cat : args.GetArgs("-debugexclude")) {

0 commit comments

Comments
 (0)