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

Unified Diff: net/quic/platform/impl/quic_ip_address_impl.cc

Issue 2881673002: Avoid heap allocations in IPAddress (Closed)
Patch Set: New constructor 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
« no previous file with comments | « net/interfaces/ip_address_struct_traits.cc ('k') | ppapi/shared_impl/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/platform/impl/quic_ip_address_impl.cc
diff --git a/net/quic/platform/impl/quic_ip_address_impl.cc b/net/quic/platform/impl/quic_ip_address_impl.cc
index e0c58f14ec87d4601c10b8d955831e48b3ff2f29..961f5f125f495b1b7e97294b318d1b9ffc6297fb 100644
--- a/net/quic/platform/impl/quic_ip_address_impl.cc
+++ b/net/quic/platform/impl/quic_ip_address_impl.cc
@@ -107,9 +107,7 @@ bool QuicIpAddressImpl::FromPackedString(const char* data, size_t length) {
QUIC_BUG << "Invalid packed IP address of length " << length;
return false;
}
- std::vector<uint8_t> ip(length);
- memcpy(&ip[0], data, length);
- ip_address_ = IPAddress(ip);
+ ip_address_ = IPAddress(reinterpret_cast<const uint8_t*>(data), length);
return true;
}
« no previous file with comments | « net/interfaces/ip_address_struct_traits.cc ('k') | ppapi/shared_impl/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698