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

Unified Diff: tools/gn/value_extractors.cc

Issue 610293003: Replace more for loops in GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 6 years, 3 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/value.cc ('k') | tools/gn/visibility.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/value_extractors.cc
diff --git a/tools/gn/value_extractors.cc b/tools/gn/value_extractors.cc
index fe86bd3d61d88f4adfaf37eac14f823149608a24..9e6a37edc95c6c27478b0434ddc7f49d6ad9d645 100644
--- a/tools/gn/value_extractors.cc
+++ b/tools/gn/value_extractors.cc
@@ -42,13 +42,13 @@ bool ListValueUniqueExtractor(const Value& value,
return false;
const std::vector<Value>& input_list = value.list_value();
- for (size_t i = 0; i < input_list.size(); i++) {
+ for (const auto& item : input_list) {
T new_one;
- if (!converter(input_list[i], &new_one, err))
+ if (!converter(item, &new_one, err))
return false;
if (!dest->push_back(new_one)) {
// Already in the list, throw error.
- *err = Err(input_list[i], "Duplicate item in list");
+ *err = Err(item, "Duplicate item in list");
size_t previous_index = dest->IndexOf(new_one);
err->AppendSubErr(Err(input_list[previous_index],
"This was the previous definition."));
@@ -143,10 +143,10 @@ bool ExtractListOfStringValues(const Value& value,
return false;
const std::vector<Value>& input_list = value.list_value();
dest->reserve(input_list.size());
- for (size_t i = 0; i < input_list.size(); i++) {
- if (!input_list[i].VerifyTypeIs(Value::STRING, err))
+ for (const auto& item : input_list) {
+ if (!item.VerifyTypeIs(Value::STRING, err))
return false;
- dest->push_back(input_list[i].string_value());
+ dest->push_back(item.string_value());
}
return true;
}
« no previous file with comments | « tools/gn/value.cc ('k') | tools/gn/visibility.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698