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

Unified Diff: net/cert/internal/name_constraints.cc

Issue 2881673002: Avoid heap allocations in IPAddress (Closed)
Patch Set: Done Created 3 years, 7 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
Index: net/cert/internal/name_constraints.cc
diff --git a/net/cert/internal/name_constraints.cc b/net/cert/internal/name_constraints.cc
index 0ed685101e9a15d6463ed693188273aed304c5fa..b275a2bce8e0502931eda65ec8fe0f90b176b8d4 100644
--- a/net/cert/internal/name_constraints.cc
+++ b/net/cert/internal/name_constraints.cc
@@ -104,7 +104,8 @@ bool DNSNameMatches(base::StringPiece name,
// Return true if the bitmask |mask| contains only zeros after the first
// |prefix_length| bits.
-bool IsSuffixZero(const std::vector<uint8_t>& mask, unsigned prefix_length) {
+bool IsSuffixZero(const IPAddress::IPAddressBytes& mask,
+ unsigned prefix_length) {
size_t zero_bits = mask.size() * CHAR_BIT - prefix_length;
size_t zero_bytes = zero_bits / CHAR_BIT;
std::vector<uint8_t> zeros(zero_bytes, 0);

Powered by Google App Engine
This is Rietveld 408576698