summary refs log tree commit diff
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-15 18:58:09 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-15 18:58:09 +0300
commite6b45263bcc25a7e5e5cb9d880a735507b88a48e (patch)
tree62e2e4c7f8d1b2bab5f07f5d3ac5c2891d406e83
parentAdd the -v / --version option, which displays the version string of the appli... (diff)
downloadnheko-e6b45263bcc25a7e5e5cb9d880a735507b88a48e.tar.xz
User reverse iterator instead of while loop
-rw-r--r--src/timeline/TimelineView.cc10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/timeline/TimelineView.cc b/src/timeline/TimelineView.cc
index ca2f6211..967436ff 100644
--- a/src/timeline/TimelineView.cc
+++ b/src/timeline/TimelineView.cc
@@ -380,13 +380,9 @@ TimelineView::renderTopEvents(const std::vector<TimelineEvent> &events)
         firstSender_.clear();
         firstMsgTimestamp_ = QDateTime();
 
-        // Parse in reverse order to determine where we should not show sender's
-        // name.
-        auto ii = events.size();
-        while (ii != 0) {
-                --ii;
-
-                auto item = parseMessageEvent(events[ii], TimelineDirection::Top);
+        // Parse in reverse order to determine where we should not show sender's name.
+        for (auto it = events.rbegin(); it != events.rend(); ++it) {
+                auto item = parseMessageEvent(*it, TimelineDirection::Top);
 
                 if (item != nullptr)
                         items.push_back(item);