summaryrefslogtreecommitdiff
path: root/init/action_parser.cpp
diff options
context:
space:
mode:
authorTom Cherry <tomcherry@google.com>2019-09-18 13:47:19 -0700
committerTom Cherry <tomcherry@google.com>2019-09-18 14:02:14 -0700
commit14c2472734ce9f92978b7193a6877c5c2ceba200 (patch)
tree4390ac8fa516766511a10c6742ca0bb17ada90ab /init/action_parser.cpp
parentb0321c1de178ac2dfd05fb6537e0e63f7eecf87e (diff)
init: degeneralize subcontext init into only vendor_init
This code is more generic than it needs to be and one of the side effects is that an extra init process is forked for odm_init, despite it having the same context as vendor_init. I don't think anything is going to change regarding that soon, so this change stops forking that extra process to save its memory and simplifies the code overall. Bug: 141164879 Test: init still uses vendor_init for vendor_scripts Test: init unit tests Test: init only has one subcontext process Change-Id: I0d224455604a681711e32f89fb20132378f69060
Diffstat (limited to 'init/action_parser.cpp')
-rw-r--r--init/action_parser.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/init/action_parser.cpp b/init/action_parser.cpp
index ff20e43a3..9736824f9 100644
--- a/init/action_parser.cpp
+++ b/init/action_parser.cpp
@@ -121,13 +121,8 @@ Result<void> ActionParser::ParseSection(std::vector<std::string>&& args,
}
Subcontext* action_subcontext = nullptr;
- if (subcontexts_) {
- for (auto& subcontext : *subcontexts_) {
- if (StartsWith(filename, subcontext.path_prefix())) {
- action_subcontext = &subcontext;
- break;
- }
- }
+ if (subcontext_ && subcontext_->PathMatchesSubcontext(filename)) {
+ action_subcontext = subcontext_;
}
std::string event_trigger;