Enable NRVO in QJsonObject::keys()
... for poor compilers (such as GCC). The test (!d) was changed to match what other member functions test for, e.g. toVariantHash(). Change-Id: I85aee0df6e50da3623ad0afce24abb586e0bd1bc Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This commit is contained in:
parent
8dc55367ca
commit
448e9fdb57
@ -270,16 +270,14 @@ QVariantHash QJsonObject::toVariantHash() const
|
||||
*/
|
||||
QStringList QJsonObject::keys() const
|
||||
{
|
||||
if (!d)
|
||||
return QStringList();
|
||||
|
||||
QStringList keys;
|
||||
keys.reserve(o->length);
|
||||
for (uint i = 0; i < o->length; ++i) {
|
||||
QJsonPrivate::Entry *e = o->entryAt(i);
|
||||
keys.append(e->key());
|
||||
if (o) {
|
||||
keys.reserve(o->length);
|
||||
for (uint i = 0; i < o->length; ++i) {
|
||||
QJsonPrivate::Entry *e = o->entryAt(i);
|
||||
keys.append(e->key());
|
||||
}
|
||||
}
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user