From 965ca9a5653506f19853146f649cc8e74b3713f1 Mon Sep 17 00:00:00 2001 From: Alden Torres Date: Mon, 9 Jul 2018 12:19:43 -0400 Subject: [PATCH] avoid copy of arrays in dht alerts constructors --- include/libtorrent/alert_types.hpp | 6 +++--- src/alert.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/libtorrent/alert_types.hpp b/include/libtorrent/alert_types.hpp index 0f159a00f..e0422243c 100644 --- a/include/libtorrent/alert_types.hpp +++ b/include/libtorrent/alert_types.hpp @@ -2214,7 +2214,7 @@ TORRENT_VERSION_NAMESPACE_2 struct TORRENT_EXPORT dht_mutable_item_alert final : alert { dht_mutable_item_alert(aux::stack_allocator& alloc - , std::array k, std::array sig + , std::array const& k, std::array const& sig , std::int64_t sequence, string_view s, entry const& i, bool a); TORRENT_DEFINE_ALERT_PRIO(dht_mutable_item_alert, 75, alert_priority_critical) @@ -2252,8 +2252,8 @@ TORRENT_VERSION_NAMESPACE_2 { // internal dht_put_alert(aux::stack_allocator& alloc, sha1_hash const& t, int n); - dht_put_alert(aux::stack_allocator& alloc, std::array key - , std::array sig + dht_put_alert(aux::stack_allocator& alloc, std::array const& key + , std::array const& sig , std::string s , std::int64_t sequence_number , int n); diff --git a/src/alert.cpp b/src/alert.cpp index 554a02f06..709ff64c3 100644 --- a/src/alert.cpp +++ b/src/alert.cpp @@ -1680,8 +1680,8 @@ namespace { // TODO: 2 the salt here is allocated on the heap. It would be nice to // allocate in in the stack_allocator dht_mutable_item_alert::dht_mutable_item_alert(aux::stack_allocator& - , std::array k - , std::array sig + , std::array const& k + , std::array const& sig , std::int64_t sequence , string_view s , entry const& i @@ -1711,8 +1711,8 @@ namespace { {} dht_put_alert::dht_put_alert(aux::stack_allocator& - , std::array key - , std::array sig + , std::array const& key + , std::array const& sig , std::string s , std::int64_t sequence_number , int n)