mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 19:33:18 +00:00
Bug 1673832 - Reduce allocations in merge_rrset. r=valentin,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D94954
This commit is contained in:
parent
fff64b3d07
commit
e83823e865
@ -20,14 +20,13 @@ static already_AddRefed<AddrInfo> merge_rrset(AddrInfo* rrto,
|
||||
bool isIPv6 = rrfrom->Addresses().Length() > 0 &&
|
||||
rrfrom->Addresses()[0].raw.family == PR_AF_INET6;
|
||||
|
||||
nsTArray<NetAddr> addresses = rrto->Addresses().Clone();
|
||||
for (const auto& addr : rrfrom->Addresses()) {
|
||||
if (isIPv6) {
|
||||
// rrfrom has IPv6 so it should be first
|
||||
addresses.InsertElementAt(0, addr);
|
||||
} else {
|
||||
addresses.AppendElement(addr);
|
||||
}
|
||||
nsTArray<NetAddr> addresses;
|
||||
if (isIPv6) {
|
||||
addresses = rrfrom->Addresses().Clone();
|
||||
addresses.AppendElements(rrto->Addresses());
|
||||
} else {
|
||||
addresses = rrto->Addresses().Clone();
|
||||
addresses.AppendElements(rrfrom->Addresses());
|
||||
}
|
||||
auto builder = rrto->Build();
|
||||
builder.SetAddresses(std::move(addresses));
|
||||
|
@ -13,6 +13,8 @@ const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
|
||||
|
||||
trr_test_setup();
|
||||
registerCleanupFunction(async () => {
|
||||
Services.prefs.clearUserPref("network.connectivity-service.nat64-prefix");
|
||||
override.clearOverrides();
|
||||
trr_clear_prefs();
|
||||
});
|
||||
|
||||
@ -114,6 +116,4 @@ add_task(async function test_add_nat64_prefix_to_trr() {
|
||||
);
|
||||
|
||||
await trrServer.stop();
|
||||
|
||||
override.clearOverrides();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user