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

Unified Diff: net/http/http_util.cc

Issue 2459243002: Replace for each loops (Closed)
Patch Set: Replace for each loop Created 4 years, 2 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 | « AUTHORS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_util.cc
diff --git a/net/http/http_util.cc b/net/http/http_util.cc
index aa2fdb6d66e9136695518474c52c53402774ffba..ff8e04cc616d28a0b2fa65b5f4d20f2687adb71b 100644
--- a/net/http/http_util.cc
+++ b/net/http/http_util.cc
@@ -345,9 +345,11 @@ bool HttpUtil::IsSafeHeader(const std::string& name) {
if (base::StartsWith(lower_name, "proxy-", base::CompareCase::SENSITIVE) ||
base::StartsWith(lower_name, "sec-", base::CompareCase::SENSITIVE))
return false;
- for (size_t i = 0; i < arraysize(kForbiddenHeaderFields); ++i) {
- if (lower_name == kForbiddenHeaderFields[i])
+
+ for (const char* field : kForbiddenHeaderFields) {
+ if (lower_name == field) {
return false;
+ }
mmenke 2016/10/31 14:49:30 nit: Don't use braces for ifs with a single line
}
return true;
}
@@ -414,9 +416,10 @@ bool HttpUtil::IsNonCoalescingHeader(std::string::const_iterator name_begin,
// one.
"strict-transport-security"
};
- for (size_t i = 0; i < arraysize(kNonCoalescingHeaders); ++i) {
+
+ for (const char* header : kNonCoalescingHeaders) {
if (base::LowerCaseEqualsASCII(base::StringPiece(name_begin, name_end),
- kNonCoalescingHeaders[i]))
+ header))
return true;
mmenke 2016/10/31 14:49:30 nit: Mind adding braces to this if, though, while
}
return false;
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698