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). Change-Id: Ief77626c77d0c8c2ce17e3b1a21496a7da969761 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io> (cherry picked from commit 063e31209b1750b6cbd2c3f57c49ce372b13a91a) Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
3516762d73
commit
0eaf2e9df8
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user