]> granicus.if.org Git - neomutt/commitdiff
refactor/simplify status %f
authorRichard Russon <rich@flatcap.org>
Tue, 25 Sep 2018 11:31:01 +0000 (12:31 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 25 Sep 2018 11:31:01 +0000 (12:31 +0100)
notmuch/mutt_notmuch.c
notmuch/mutt_notmuch.h
status.c

index e7da459b630d729d3f8cc4a9864d25a18283da96..dbf6990667dbd316a150c5aa6a671369b635d6c1 100644 (file)
@@ -2191,24 +2191,6 @@ done:
   return rc;
 }
 
-/**
- * nm_get_description - Get the folder's description
- * @param  mailbox Mailbox
- * @retval ptr     Description
- * @retval NULL No description
- */
-char *nm_get_description(struct Mailbox *mailbox)
-{
-  struct MailboxNode *np = NULL;
-  STAILQ_FOREACH(np, &AllMailboxes, entries)
-  {
-    if (np->m->desc && (strcmp(np->m->path, mailbox->path) == 0))
-      return np->m->desc;
-  }
-
-  return NULL;
-}
-
 /**
  * nm_description_to_path - Find a path from a folder's description
  * @param desc   Description
index 21c3def1645bca73eb36f2a9d927265d24e327ad..dbeeb5f899e5c7aa6ffc218a02a20f72d4225f72 100644 (file)
@@ -56,7 +56,6 @@ extern struct MxOps mx_notmuch_ops;
 void  nm_debug_check             (struct Mailbox *mailbox);
 int   nm_description_to_path     (const char *desc, char *buf, size_t buflen);
 int   nm_get_all_tags            (struct Mailbox *mailbox, char **tag_list, int *tag_count);
-char *nm_get_description         (struct Mailbox *mailbox);
 char *nm_email_get_folder        (struct Email *e);
 void  nm_longrun_done            (struct Mailbox *mailbox);
 void  nm_longrun_init            (struct Mailbox *mailbox, bool writable);
index c7786f2d4eca20f93ff544ea92c1191ea5c2b7f8..afde887ca099a3de7f21683376a65cc8bfaa2f8a 100644 (file)
--- a/status.c
+++ b/status.c
@@ -123,25 +123,23 @@ static const char *status_format_str(char *buf, size_t buflen, size_t col, int c
 
     case 'f':
     {
+      struct Mailbox *m = Context ? Context->mailbox : NULL;
 #ifdef USE_NOTMUCH
-      char *p = NULL;
-      if (Context && Context->mailbox->magic == MUTT_NOTMUCH &&
-          (p = nm_get_description(Context->mailbox)))
-        mutt_str_strfcpy(tmp, p, sizeof(tmp));
+      if (m && (m->magic == MUTT_NOTMUCH) && m->desc)
+        mutt_str_strfcpy(tmp, m->desc, sizeof(tmp));
       else
 #endif
 #ifdef USE_COMPRESSED
-          if (Context && Context->mailbox->compress_info &&
-              (Context->mailbox->realpath[0] != '\0'))
+          if (m && m->compress_info && (m->realpath[0] != '\0'))
       {
-        mutt_str_strfcpy(tmp, Context->mailbox->realpath, sizeof(tmp));
+        mutt_str_strfcpy(tmp, m->realpath, sizeof(tmp));
         mutt_pretty_mailbox(tmp, sizeof(tmp));
       }
       else
 #endif
-          if (Context && (Context->mailbox->path[0] != '\0'))
+          if (m && (m->path[0] != '\0'))
       {
-        mutt_str_strfcpy(tmp, Context->mailbox->path, sizeof(tmp));
+        mutt_str_strfcpy(tmp, m->path, sizeof(tmp));
         mutt_pretty_mailbox(tmp, sizeof(tmp));
       }
       else