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:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user