Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(575)

Unified Diff: tools/gn/pattern.cc

Issue 986113002: tools/gn: Convert for loops to use the new range-based loops in C++11. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review fixes Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/operators.cc ('k') | tools/gn/standard_out.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/pattern.cc
diff --git a/tools/gn/pattern.cc b/tools/gn/pattern.cc
index 10ff5a436505d8c5ec3d5380fa4f14988cb557ad..4b14d2aae5251fdf3cd3a6be0eaf252aab7be9d1 100644
--- a/tools/gn/pattern.cc
+++ b/tools/gn/pattern.cc
@@ -167,16 +167,16 @@ void PatternList::SetFromValue(const Value& v, Err* err) {
}
const std::vector<Value>& list = v.list_value();
- for (size_t i = 0; i < list.size(); i++) {
- if (!list[i].VerifyTypeIs(Value::STRING, err))
+ for (const auto& elem : list) {
+ if (!elem.VerifyTypeIs(Value::STRING, err))
return;
- patterns_.push_back(Pattern(list[i].string_value()));
+ patterns_.push_back(Pattern(elem.string_value()));
}
}
bool PatternList::MatchesString(const std::string& s) const {
- for (size_t i = 0; i < patterns_.size(); i++) {
- if (patterns_[i].MatchesString(s))
+ for (const auto& pattern : patterns_) {
+ if (pattern.MatchesString(s))
return true;
}
return false;
« no previous file with comments | « tools/gn/operators.cc ('k') | tools/gn/standard_out.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698