summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2021-07-06 07:39:09 +0200
committerMarc Mutz <marc.mutz@kdab.com>2021-07-06 21:35:51 +0200
commit713fad1c588b09296e6a358ff2b15fc36b2bc640 (patch)
treefe63b289975a05af4ea1565aeae90fb7645478b0 /src/corelib/tools
parentdd06439f5e2faa706d925894a2f1b3babd5a21ee (diff)
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>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qcryptographichash.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp
index ffa3e415e3..f5c5cbb204 100644
--- a/src/corelib/tools/qcryptographichash.cpp
+++ b/src/corelib/tools/qcryptographichash.cpp
@@ -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();
}
/*!