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/profile.cc b/profile.cc
index 0ec0121..475ac31 100644
--- a/profile.cc
+++ b/profile.cc
@@ -223,8 +223,8 @@
   if (token.empty()) {
     return false;
   }
-  for (string::const_iterator it = token.begin(); it != token.end(); ++it) {
-    if (!IsAsciiAlpha(*it) && !IsAsciiDigit(*it)) {
+  for (auto chr : token) {
+    if (!IsAsciiAlpha(chr) && !IsAsciiDigit(chr)) {
       return false;
     }
   }
@@ -283,9 +283,7 @@
 
   vector<string> profile_lines;
   base::SplitStringDontTrim(profile_data, '\n', &profile_lines);
-  vector<string>::const_iterator it;
-  for (it = profile_lines.begin(); it != profile_lines.end(); ++it) {
-    const string &line = *it;
+  for (const auto &line : profile_lines) {
     if (line.empty()) {
       // This will be the case on the last line, so let's not complain about it.
       continue;
@@ -314,9 +312,8 @@
 bool Profile::SaveUserProfileList(const FilePath &path,
                                   const vector<ProfileRefPtr> &profiles) {
   vector<string> lines;
-  vector<ProfileRefPtr>::const_iterator it;
-  for (it = profiles.begin(); it != profiles.end(); ++it) {
-    Identifier &id = (*it)->name_;
+  for (const auto &profile : profiles) {
+    Identifier &id = profile->name_;
     if (id.user.empty()) {
       continue;
     }
@@ -359,15 +356,13 @@
 }
 
 vector<string> Profile::EnumerateEntries(Error */*error*/) {
-  set<string> groups(storage_->GetGroups());
   vector<string> service_groups;
 
   // Filter this list down to only entries that correspond
   // to a technology.  (wifi_*, etc)
-  for (set<string>::iterator it = groups.begin();
-       it != groups.end(); ++it) {
-    if (Technology::IdentifierFromStorageGroup(*it) != Technology::kUnknown)
-      service_groups.push_back(*it);
+  for (const auto &group : storage_->GetGroups()) {
+    if (Technology::IdentifierFromStorageGroup(group) != Technology::kUnknown)
+      service_groups.push_back(group);
   }
 
   return service_groups;