diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-11-12 21:01:20 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-11-14 16:49:39 +0000 |
commit | 80842959c4f63be930c77da39df7ac386dcaa1d7 (patch) | |
tree | f73bbdfd5ab054a31e52011e1a02b5db34cdd38b /src/corelib/json | |
parent | addf1f45f3e2c37a09ef7f7bab909467c2bf79f7 (diff) |
Revert "Optimize QJsonObject::operator=="
This reverts commit 862fa24179505ef725ff78bb64bdabd54bd00c95,
which attempted to optimize QJsonObject::operator== under the
assumption that the entries it holds are lexicographically
sorted. They should be, because Object::indexOf() finds them
by binary search, but apparently both fromJson(), as well as
construction through op[] leave (some) entries unsorted.
This behavior should be fixed, because other code relies on
sorted entries, too, but until the problem is more fully under-
stood, revert the patch to unbreak equality comparisons.
Task-number: QTBUG-56843
Change-Id: I5b608c16d1bbcb4f01b75ce93bd58b49ff050be2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/json')
-rw-r--r-- | src/corelib/json/qjson_p.h | 2 | ||||
-rw-r--r-- | src/corelib/json/qjsonobject.cpp | 4 |
2 files changed, 2 insertions, 4 deletions
diff --git a/src/corelib/json/qjson_p.h b/src/corelib/json/qjson_p.h index c5fd38e640..5be31ca03f 100644 --- a/src/corelib/json/qjson_p.h +++ b/src/corelib/json/qjson_p.h @@ -691,8 +691,6 @@ public: bool operator >=(const Entry &other) const; }; -inline bool operator!=(const Entry &lhs, const Entry &rhs) { return !(lhs == rhs); } - inline bool Entry::operator >=(const QString &key) const { if (value.latinKey) diff --git a/src/corelib/json/qjsonobject.cpp b/src/corelib/json/qjsonobject.cpp index f5fd76eac0..b83c8dd19a 100644 --- a/src/corelib/json/qjsonobject.cpp +++ b/src/corelib/json/qjsonobject.cpp @@ -545,8 +545,8 @@ bool QJsonObject::operator==(const QJsonObject &other) const for (uint i = 0; i < o->length; ++i) { QJsonPrivate::Entry *e = o->entryAt(i); - QJsonPrivate::Entry *oe = other.o->entryAt(i); - if (*e != *oe || QJsonValue(d, o, e->value) != QJsonValue(other.d, other.o, oe->value)) + QJsonValue v(d, o, e->value); + if (other.value(e->key()) != v) return false; } |