Bug 1324547 - ensure we're not needlessly copying things in ranged for loop
MozReview-Commit-ID: 2NnjjmANem5
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -1574,17 +1574,17 @@ nsPluginHost::RegisterFakePlugin(JS::Han
if (!initDictionary.Init(aCx, aInitDictionary)) {
return NS_ERROR_FAILURE;
}
RefPtr<nsFakePluginTag> newTag;
nsresult rv = nsFakePluginTag::Create(initDictionary, getter_AddRefs(newTag));
NS_ENSURE_SUCCESS(rv, rv);
- for (auto existingTag : mFakePlugins) {
+ for (const auto& existingTag : mFakePlugins) {
if (newTag->HandlerURIMatches(existingTag->HandlerURI())) {
return NS_ERROR_UNEXPECTED;
}
}
mFakePlugins.AppendElement(newTag);
// FIXME-jsplugins do we need to register with the category manager here? For
// shumway, for now, probably not.
--- a/media/mtransport/test/ice_unittest.cpp
+++ b/media/mtransport/test/ice_unittest.cpp
@@ -640,17 +640,17 @@ class IceTestPeer : public sigslot::has_
void SetExpectedRemoteCandidateAddr(const std::string& addr) {
expected_remote_addr_ = addr;
}
int GetCandidatesPrivateIpv4Range(size_t stream) {
std::vector<std::string> candidates = GetCandidates(stream);
int host_net = 0;
- for (auto c : candidates) {
+ for (const auto& c : candidates) {
if (c.find("typ host") != std::string::npos) {
nr_transport_addr addr;
std::vector<std::string> tokens = split(c, ' ');
int r = nr_str_port_to_transport_addr(tokens.at(4).c_str(), 0, IPPROTO_UDP, &addr);
MOZ_ASSERT(!r);
if (!r && (addr.ip_version == NR_IPV4)) {
int n = nr_transport_addr_get_private_addr_range(&addr);
if (n) {
@@ -1604,17 +1604,17 @@ class WebRtcIceGatherTest : public StunT
}
void DumpCandidates(unsigned int stream) {
std::vector<std::string> candidates = peer_->GetCandidates(stream);
std::cerr << "Candidates for stream " << stream << "->"
<< candidates.size() << std::endl;
- for (auto c : candidates) {
+ for (const auto& c : candidates) {
std::cerr << "Candidate: " << c << std::endl;
}
}
protected:
mozilla::UniquePtr<IceTestPeer> peer_;
};