D21121: Fix leaking of requests in ItemRetriever::exec()

David Faure noreply at phabricator.kde.org
Sat May 11 14:00:45 BST 2019


dfaure marked an inline comment as done.
dfaure added inline comments.

INLINE COMMENTS

> anthonyfieroni wrote in itemretriever.cpp:284
> `emplace_back(lastRequest)`

Good suggestion, thanks.

> anthonyfieroni wrote in itemretriever.cpp:332-335
> `for (auto it = requests.begin(); it != requests.end(); ++it)`
> Will be better.

A `for` loop better than `find_if`? What makes you say that?
I want to find one element and process it.
With a `for` loop I'd need to insert an `if()`, and a `break`... and it would mean mixing finding and processing. And the reader wouldn't be immediately sure that I'm only looking for one item, until finding the break much further down.

It's general consensus that using an algorithm is always better than writing a `for` loop.

REPOSITORY
  R165 Akonadi

REVISION DETAIL
  https://phabricator.kde.org/D21121

To: dfaure, dvratil
Cc: anthonyfieroni, kde-pim, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20190511/6c3f62df/attachment.html>


More information about the kde-pim mailing list