Reduce number of unneeded copies

This patch aims at reducing the number of copies for obejcts that could
be referenced rather than copied, because they're not modified during
the computation.
This commit is contained in:
Gianluca Recchia
2018-10-28 12:49:32 +01:00
parent a67a574b89
commit da9afd3f6f
40 changed files with 90 additions and 90 deletions

View File

@@ -153,7 +153,7 @@ bool CompositeKey::challenge(const QByteArray& seed, QByteArray& result) const
*
* @param key the key
*/
void CompositeKey::addKey(QSharedPointer<Key> key)
void CompositeKey::addKey(const QSharedPointer<Key>& key)
{
m_keys.append(key);
}
@@ -173,7 +173,7 @@ const QList<QSharedPointer<Key>>& CompositeKey::keys() const
*
* @param key the key
*/
void CompositeKey::addChallengeResponseKey(QSharedPointer<ChallengeResponseKey> key)
void CompositeKey::addChallengeResponseKey(const QSharedPointer<ChallengeResponseKey>& key)
{
m_challengeResponseKeys.append(key);
}

View File

@@ -42,10 +42,10 @@ public:
Q_REQUIRED_RESULT bool transform(const Kdf& kdf, QByteArray& result) const;
bool challenge(const QByteArray& seed, QByteArray& result) const;
void addKey(QSharedPointer<Key> key);
void addKey(const QSharedPointer<Key>& key);
const QList<QSharedPointer<Key>>& keys() const;
void addChallengeResponseKey(QSharedPointer<ChallengeResponseKey> key);\
void addChallengeResponseKey(const QSharedPointer<ChallengeResponseKey>& key);\
const QList<QSharedPointer<ChallengeResponseKey>>& challengeResponseKeys() const;
private: