ueventd: replace ueventd_parser.cpp with init_parser.cpp
Previously init_parser.cpp was made generic and capable of parsing any
number of differently named 'sections' or prefixed lines. We now use
these capabilities to do the parsing for ueventd.
Bug: 36250207
Bug: 33785894
Test: boot bullhead and ensure the right /dev nodes exist
with the right permissions set
Test: verify no boot time difference
Change-Id: I698ca962d414f8135af32f6c9cd778841b2b8b53
diff --git a/init/keyword_map.h b/init/keyword_map.h
index 2b91260..88bad01 100644
--- a/init/keyword_map.h
+++ b/init/keyword_map.h
@@ -31,11 +31,16 @@
virtual ~KeywordMap() {
}
- const Function FindFunction(const std::string& keyword,
- size_t num_args,
- std::string* err) const {
+ const Function FindFunction(const std::vector<std::string>& args, std::string* err) const {
using android::base::StringPrintf;
+ if (args.empty()) {
+ *err = "keyword needed, but not provided";
+ return nullptr;
+ }
+ auto& keyword = args[0];
+ auto num_args = args.size() - 1;
+
auto function_info_it = map().find(keyword);
if (function_info_it == map().end()) {
*err = StringPrintf("invalid keyword '%s'", keyword.c_str());