refactor(dwarfsck): prevent shadowing of local variable

This commit is contained in:
Marcus Holland-Moritz 2024-01-16 14:49:39 +01:00
parent 860912e5e4
commit 1e6d76dec6

View File

@ -55,7 +55,7 @@ int dwarfsck_main(int argc, sys_char** argv, iolayer const& iol) {
size_t num_workers; size_t num_workers;
int detail; int detail;
bool quiet{false}; bool quiet{false};
bool json{false}; bool output_json{false};
bool check_integrity{false}; bool check_integrity{false};
bool no_check{false}; bool no_check{false};
bool print_header{false}; bool print_header{false};
@ -88,7 +88,7 @@ int dwarfsck_main(int argc, sys_char** argv, iolayer const& iol) {
po::value<bool>(&no_check)->zero_tokens(), po::value<bool>(&no_check)->zero_tokens(),
"don't even verify block checksums") "don't even verify block checksums")
("json,j", ("json,j",
po::value<bool>(&json)->zero_tokens(), po::value<bool>(&output_json)->zero_tokens(),
"print information in JSON format") "print information in JSON format")
("export-metadata", ("export-metadata",
po::value<std::string>(&export_metadata), po::value<std::string>(&export_metadata),
@ -131,7 +131,8 @@ int dwarfsck_main(int argc, sys_char** argv, iolayer const& iol) {
return 1; return 1;
} }
if (print_header && (json || !export_metadata.empty() || check_integrity)) { if (print_header &&
(output_json || !export_metadata.empty() || check_integrity)) {
LOG_WARN << "--print-header is mutually exclusive with --json, " LOG_WARN << "--print-header is mutually exclusive with --json, "
"--export-metadata and --check-integrity"; "--export-metadata and --check-integrity";
return 1; return 1;
@ -184,7 +185,7 @@ int dwarfsck_main(int argc, sys_char** argv, iolayer const& iol) {
auto errors = no_check ? 0 : fs.check(level, num_workers); auto errors = no_check ? 0 : fs.check(level, num_workers);
if (!quiet) { if (!quiet) {
if (json) { if (output_json) {
iol.out << folly::toPrettyJson(fs.info_as_dynamic(detail)) << "\n"; iol.out << folly::toPrettyJson(fs.info_as_dynamic(detail)) << "\n";
} else { } else {
fs.dump(iol.out, detail); fs.dump(iol.out, detail);