[pim/trojita] src/Imap/Parser: Avoid allocating an unneeded temporary container

Espen Sandøy Hustad <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 7a8406ed72dffbceb887afac532f352b4278898a by Espen Sandøy Hustad.
Committed on 10/08/2026 at 16:36.
Pushed by ehustad into branch 'master'.

Avoid allocating an unneeded temporary container

Checks further below already checks if QMap 1 contains all
keys in QMap 2. Checking that the size of both QMaps are equal
should therefore be sufficient. No need to create a QList of all
keys and compare them.

Fix Clazy warning:
- src/Imap/Parser/Response.cpp:1474:13: warning: allocating an unneeded
  temporary container [-Wclazy-container-anti-pattern]

M  +1    -1    src/Imap/Parser/Response.cpp

https://invent.kde.org/pim/trojita/-/commit/7a8406ed72dffbceb887afac532f352b4278898a

diff --git a/src/Imap/Parser/Response.cpp b/src/Imap/Parser/Response.cpp
index 23a6ffcba..2dc5fe1b0 100644
--- a/src/Imap/Parser/Response.cpp
+++ b/src/Imap/Parser/Response.cpp
@@ -1471,7 +1471,7 @@ bool Fetch::eq(const AbstractResponse &other) const
         const Fetch &f = dynamic_cast<const Fetch &>(other);
         if (number != f.number)
             return false;
-        if (data.keys() != f.data.keys())
+        if (data.size() != f.data.size())
             return false;
         for (dataType::const_iterator it = data.begin();
              it != data.end(); ++it)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.