]> granicus.if.org Git - neomutt/commitdiff
sidebar: Use an explicit fast path for checking visibility
authorDarshit Shah <git@darnir.net>
Tue, 26 Mar 2019 06:56:29 +0000 (07:56 +0100)
committerRichard Russon <rich@flatcap.org>
Thu, 28 Mar 2019 09:30:42 +0000 (09:30 +0000)
sidebar.c

index 0a3fe8f9b39078d5240645deba3793554f149433..0a723aa5d45c0c2b6cbaa3426af3058130593c44 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
@@ -356,15 +356,23 @@ static void update_entries_visibility(void)
 {
   short new_only = C_SidebarNewMailOnly;
   struct SbEntry *sbe = NULL;
+
+  /* Take the fast path if there is no need to test visibilities */
+  if (!new_only)
+  {
+    for (int i = 0; i < EntryCount; i++)
+    {
+      Entries[i]->is_hidden = false;
+    }
+    return;
+  }
+
   for (int i = 0; i < EntryCount; i++)
   {
     sbe = Entries[i];
 
     sbe->is_hidden = false;
 
-    if (!new_only)
-      continue;
-
     if ((i == OpnIndex) || (sbe->mailbox->msg_unread > 0) ||
         sbe->mailbox->has_new || (sbe->mailbox->msg_flagged > 0))
     {