diff options
author | Tom Cherry <tomcherry@google.com> | 2017-08-02 17:01:36 -0700 |
---|---|---|
committer | Tom Cherry <tomcherry@google.com> | 2017-08-14 10:27:33 -0700 |
commit | b592dd8afff487e5ba73bbd782cfa7501a65e88e (patch) | |
tree | 22dde0feaeec6d370a71fe8d324d4b59f5c6f6b0 /init/import_parser.cpp | |
parent | 7fa62c58d603dc1bc56d73a22bbf7f9a0dd3059e (diff) |
init: use Result<T> for the parsing functions
Test: boot bullhead
Change-Id: I7f00c5f0f54dd4fe05df73e1d6a89b56d788e113
Diffstat (limited to 'init/import_parser.cpp')
-rw-r--r-- | init/import_parser.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/init/import_parser.cpp b/init/import_parser.cpp index b9fa2cea7..e335fd111 100644 --- a/init/import_parser.cpp +++ b/init/import_parser.cpp @@ -23,24 +23,22 @@ namespace android { namespace init { -bool ImportParser::ParseSection(std::vector<std::string>&& args, const std::string& filename, - int line, std::string* err) { +Result<Success> ImportParser::ParseSection(std::vector<std::string>&& args, + const std::string& filename, int line) { if (args.size() != 2) { - *err = "single argument needed for import\n"; - return false; + return Error() << "single argument needed for import\n"; } std::string conf_file; bool ret = expand_props(args[1], &conf_file); if (!ret) { - *err = "error while expanding import"; - return false; + return Error() << "error while expanding import"; } LOG(INFO) << "Added '" << conf_file << "' to import list"; if (filename_.empty()) filename_ = filename; imports_.emplace_back(std::move(conf_file), line); - return true; + return Success(); } void ImportParser::EndFile() { |