diff options
-rw-r--r-- | init/Android.mk | 1 | ||||
-rw-r--r-- | init/action.cpp | 13 |
2 files changed, 6 insertions, 8 deletions
diff --git a/init/Android.mk b/init/Android.mk index 1a47eb441..2a1ad9cdb 100644 --- a/init/Android.mk +++ b/init/Android.mk @@ -17,6 +17,7 @@ init_cflags += \ -Wall -Wextra \ -Wno-unused-parameter \ -Werror \ + -std=gnu++1z \ # -- diff --git a/init/action.cpp b/init/action.cpp index 65bf29277..09de81a5a 100644 --- a/init/action.cpp +++ b/init/action.cpp @@ -146,8 +146,7 @@ bool Action::ParsePropertyTrigger(const std::string& trigger, std::string* err) std::string prop_value(prop_name.substr(equal_pos + 1)); prop_name.erase(equal_pos); - auto res = property_triggers_.emplace(prop_name, prop_value); - if (res.second == false) { + if (auto [it, inserted] = property_triggers_.emplace(prop_name, prop_value); !inserted) { *err = "multiple property triggers found for same property"; return false; } @@ -212,9 +211,7 @@ bool Action::CheckPropertyTriggers(const std::string& name, } bool found = name.empty(); - for (const auto& t : property_triggers_) { - const auto& trigger_name = t.first; - const auto& trigger_value = t.second; + for (const auto& [trigger_name, trigger_value] : property_triggers_) { if (trigger_name == name) { if (trigger_value != "*" && trigger_value != value) { return false; @@ -251,10 +248,10 @@ bool Action::TriggersEqual(const Action& other) const { std::string Action::BuildTriggersString() const { std::string result; - for (const auto& t : property_triggers_) { - result += t.first; + for (const auto& [trigger_name, trigger_value] : property_triggers_) { + result += trigger_name; result += '='; - result += t.second; + result += trigger_value; result += ' '; } if (!event_trigger_.empty()) { |