From 0eaf2e9df87de6893bdf2b32433ee4ac326fb192 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 17 Apr 2024 18:29:22 +0200 Subject: [PATCH] QRestReply: micro-optimize optional handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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). Change-Id: Ief77626c77d0c8c2ce17e3b1a21496a7da969761 Reviewed-by: Juha Vuolle (cherry picked from commit 063e31209b1750b6cbd2c3f57c49ce372b13a91a) Reviewed-by: MÃ¥rten Nordheim --- src/network/access/qrestreply.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/access/qrestreply.cpp b/src/network/access/qrestreply.cpp index e7dea72c965..a19ff1af90f 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); + d->decoder.emplace(charset); 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;