Convert system/core to Result::ok()
No functionality changes, this is a mechanical cleanup.
Test: m
Test: cd system/core && atest
Change-Id: Ifdaa3ce1947ed578f656d5a446978726eb416c36
diff --git a/init/parser.cpp b/init/parser.cpp
index 6ab61cb..507ee4a 100644
--- a/init/parser.cpp
+++ b/init/parser.cpp
@@ -61,7 +61,7 @@
bad_section_found = false;
if (section_parser == nullptr) return;
- if (auto result = section_parser->EndSection(); !result) {
+ if (auto result = section_parser->EndSection(); !result.ok()) {
parse_error_count_++;
LOG(ERROR) << filename << ": " << section_start_line << ": " << result.error();
}
@@ -92,7 +92,7 @@
if (line_callback != line_callbacks_.end()) {
end_section();
- if (auto result = line_callback->second(std::move(args)); !result) {
+ if (auto result = line_callback->second(std::move(args)); !result.ok()) {
parse_error_count_++;
LOG(ERROR) << filename << ": " << state.line << ": " << result.error();
}
@@ -101,8 +101,8 @@
section_parser = section_parsers_[args[0]].get();
section_start_line = state.line;
if (auto result =
- section_parser->ParseSection(std::move(args), filename, state.line);
- !result) {
+ section_parser->ParseSection(std::move(args), filename, state.line);
+ !result.ok()) {
parse_error_count_++;
LOG(ERROR) << filename << ": " << state.line << ": " << result.error();
section_parser = nullptr;
@@ -110,7 +110,7 @@
}
} else if (section_parser) {
if (auto result = section_parser->ParseLineSection(std::move(args), state.line);
- !result) {
+ !result.ok()) {
parse_error_count_++;
LOG(ERROR) << filename << ": " << state.line << ": " << result.error();
}
@@ -143,7 +143,7 @@
LOG(INFO) << "Parsing file " << path << "...";
android::base::Timer t;
auto config_contents = ReadFile(path);
- if (!config_contents) {
+ if (!config_contents.ok()) {
LOG(INFO) << "Unable to read config file '" << path << "': " << config_contents.error();
return false;
}