Skip to content

Commit 3e1551d

Browse files
tniessentargos
authored andcommitted
src: move shared_ptr objects in KeyObjectData
Since copying `shared_ptr` may involve costly atomic operations, explicitly move both `shared_ptr` objects that are passed to the private KeyObjectData constructor. PR-URL: #59472 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent c38988c commit 3e1551d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/crypto/crypto_keys.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class KeyObjectData final : public MemoryRetainer {
127127
KeyObjectData(KeyType type,
128128
std::shared_ptr<Mutex> mutex,
129129
std::shared_ptr<Data> data)
130-
: key_type_(type), mutex_(mutex), data_(data) {}
130+
: key_type_(type), mutex_(std::move(mutex)), data_(std::move(data)) {}
131131
};
132132

133133
class KeyObjectHandle : public BaseObject {

0 commit comments

Comments
 (0)