summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2024-04-17 18:29:22 +0200
committerMarc Mutz <marc.mutz@qt.io>2024-04-18 11:31:00 +0200
commit063e31209b1750b6cbd2c3f57c49ce372b13a91a (patch)
tree5b49849263ff44cbabf756ff40ac107df2576ba4 /src
parent26e75d452eeb2762fa3ece1c63e94d01587c6260 (diff)
QRestReply: micro-optimize optional<QStringDecoder> handling
Use optional::emplace() instead of assignment from an rvalue. Saves the move constructor and destructor calls, both of which are not trivial (due to cleanFn). Pick-to: 6.7 Change-Id: Ief77626c77d0c8c2ce17e3b1a21496a7da969761 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/network/access/qrestreply.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/network/access/qrestreply.cpp b/src/network/access/qrestreply.cpp
index aa32b966f99..3cc62c7efa9 100644
--- a/src/network/access/qrestreply.cpp
+++ b/src/network/access/qrestreply.cpp
@@ -173,7 +173,7 @@ QString QRestReply::readText()
if (!d->decoder) {
const QByteArray charset = QRestReplyPrivate::contentCharset(wrapped);
- d->decoder = QStringDecoder(charset.constData());
+ d->decoder.emplace(charset.constData());
if (!d->decoder->isValid()) { // the decoder may not support the mimetype's charset
qCWarning(lcQrest, "readText(): Charset \"%s\" is not supported", charset.constData());
return result;