shill: Remove trivial use of iterators
Move trivial iterations through containers from using an iterator
to using range-based for loops. In instances where it makes sense
also use "auto" for iterators in non-trivial for loops as well.
BUG=None
TEST=Unit tests
Change-Id: I840d90fb62dc96d45f63144462b9a53b28c25ee9
Reviewed-on: https://chromium-review.googlesource.com/198051
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/hook_table.cc b/hook_table.cc
index 6d23569..418ce07 100644
--- a/hook_table.cc
+++ b/hook_table.cc
@@ -74,16 +74,14 @@
// Otherwise, if the first action completes inline, its call to
// ActionComplete() will cause the |done| callback to be invoked before the
// rest of the actions get started.
- for (HookTableMap::iterator it = hook_table_.begin();
- it != hook_table_.end(); ++it) {
- HookAction *action = &it->second;
+ for (auto &hook_entry : hook_table_) {
+ HookAction *action = &hook_entry.second;
action->started = true;
action->completed = false;
}
// Now start the actions.
- for (HookTableMap::iterator it = hook_table_.begin();
- it != hook_table_.end(); ++it) {
- it->second.start.Run();
+ for (auto &hook_entry : hook_table_) {
+ hook_entry.second.start.Run();
}
}