diff options
| author | Linus Jahn <lnj@kaidan.im> | 2022-03-02 22:31:12 +0100 |
|---|---|---|
| committer | Linus Jahn <lnj@kaidan.im> | 2022-03-03 13:49:50 +0100 |
| commit | 274da5d7bc049c748b0eb04f24275efe15ab7720 (patch) | |
| tree | 829789ee3cdf377a570830642d262027cdf0dd53 /src/client/QXmppAtmManager.cpp | |
| parent | ec1480a11ee69924712b3b1b10cde7fbf6ba1866 (diff) | |
| download | qxmpp-274da5d7bc049c748b0eb04f24275efe15ab7720.tar.gz | |
Stanza: Make E2eeMetadata optional to avoid allocation
Avoids an allocation of the E2eeMetadataPrivate object when it's not
used.
It doesn't use optional<E2eeMetadata> directly because that wouldn't
avoid the allocation and takes up 16 bytes instead of 8.
This concept could be generalized and used elsewhere in the code
(e.g. extended addresses in the stanza are unused 99% of the time).
Diffstat (limited to 'src/client/QXmppAtmManager.cpp')
| -rw-r--r-- | src/client/QXmppAtmManager.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/client/QXmppAtmManager.cpp b/src/client/QXmppAtmManager.cpp index 957ed8ef..2c9a8568 100644 --- a/src/client/QXmppAtmManager.cpp +++ b/src/client/QXmppAtmManager.cpp @@ -297,7 +297,8 @@ QFuture<void> QXmppAtmManager::handleMessage(const QXmppMessage &message) trustMessageElement->usage() == ns_atm && message.from() != client()->configuration().jid()) { const auto senderJid = QXmppUtils::jidToBareJid(message.from()); - const auto senderKey = message.e2eeMetadata().senderKey(); + const auto e2eeMetadata = message.e2eeMetadata(); + const auto senderKey = e2eeMetadata ? e2eeMetadata->senderKey() : QByteArray(); const auto encryption = trustMessageElement->encryption(); auto future = m_trustStorage->trustLevel(encryption, senderKey); |
