QCryptographicHash: don't allocate a Private in hash()

Just create it on the stack, we know the lifetime.

Reduces memory allocations in static hash() from 2 to 1.

Change-Id: Ie0e22b023331da9a6f39c80b4cd1a5c016f63a87
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Marc Mutz 2021-07-06 07:39:09 +02:00
parent dd06439f5e
commit 713fad1c58

View File

@ -665,9 +665,9 @@ QByteArray QCryptographicHashPrivate::finalize()
*/
QByteArray QCryptographicHash::hash(QByteArrayView data, Algorithm method)
{
QCryptographicHash hash(method);
QCryptographicHashPrivate hash(method);
hash.addData(data);
return hash.result();
return hash.finalize();
}
/*!