From 98b3e819ca65fc7b531eb34e7f66dd3bbb781637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C5=93ur?= Date: Sun, 26 Nov 2023 18:27:40 +0100 Subject: [PATCH] fix: Local variable 'pex' will be copied despite being returned by name (#6300) --- libtransmission/tr-dht.cc | 2 +- libtransmission/variant.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libtransmission/tr-dht.cc b/libtransmission/tr-dht.cc index a38e5d3b8..a3bcda65d 100644 --- a/libtransmission/tr-dht.cc +++ b/libtransmission/tr-dht.cc @@ -388,7 +388,7 @@ private: }; pex.erase(std::remove_if(std::begin(pex), std::end(pex), IsBadPex), std::end(pex)); - return pex; + return std::move(pex); } static void callback(void* vself, int event, unsigned char const* info_hash, void const* data, size_t data_len) diff --git a/libtransmission/variant.h b/libtransmission/variant.h index 58a220757..acb59f88c 100644 --- a/libtransmission/variant.h +++ b/libtransmission/variant.h @@ -143,7 +143,7 @@ public: return { iter->second, false }; } - return { vec_.emplace_back(key, tr_variant{ std::move(val) }).second, true }; + return { vec_.emplace_back(key, tr_variant{ std::forward(val) }).second, true }; } // --- custom functions