From: Richard Russon Date: Fri, 9 Nov 2018 00:20:00 +0000 (+0000) Subject: mailbox: drop unnec function X-Git-Tag: 2019-10-25~557 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a6e27b65db4a919bc95c9f1038d72db650ab61f5;p=neomutt mailbox: drop unnec function Fixes #1388 Thanks to @alyssais and @puckipedia. --- diff --git a/mailbox.c b/mailbox.c index 429f93ae9..f00ca0030 100644 --- a/mailbox.c +++ b/mailbox.c @@ -410,38 +410,6 @@ static void mailbox_check(struct Mailbox *m, struct stat *ctx_sb, bool check_sta MailboxNotify++; } -/** - * mailbox_get - Fetch mailbox object for given path, if present - * @param path Path to the mailbox - * @retval ptr Mailbox for the path - */ -static struct Mailbox *mailbox_get(const char *path) -{ - if (!path) - return NULL; - - char *epath = mutt_str_strdup(path); - if (!epath) - return NULL; - - mutt_expand_path(epath, mutt_str_strlen(epath)); - - struct MailboxNode *np = NULL; - STAILQ_FOREACH(np, &AllMailboxes, entries) - { - /* must be done late because e.g. IMAP delimiter may change */ - mutt_expand_path(np->m->path, sizeof(np->m->path)); - if (mutt_str_strcmp(np->m->path, path) == 0) - { - FREE(&epath); - return np->m; - } - } - - FREE(&epath); - return NULL; -} - /** * mutt_mailbox_cleanup - Restore the timestamp of a mailbox * @param path Path to the mailbox @@ -897,11 +865,10 @@ bool mutt_mailbox_list(void) /** * mutt_mailbox_setnotified - Note when the user was last notified of new mail - * @param path Path to the mailbox + * @param m Mailbox */ -void mutt_mailbox_setnotified(const char *path) +void mutt_mailbox_setnotified(struct Mailbox *m) { - struct Mailbox *m = mailbox_get(path); if (!m) return; diff --git a/mailbox.h b/mailbox.h index 4de35c198..92ef85b2a 100644 --- a/mailbox.h +++ b/mailbox.h @@ -152,7 +152,7 @@ void mutt_update_mailbox(struct Mailbox *m); void mutt_mailbox_cleanup(const char *path, struct stat *st); /** mark mailbox just left as already notified */ -void mutt_mailbox_setnotified(const char *path); +void mutt_mailbox_setnotified(struct Mailbox *m); /* force flags passed to mutt_mailbox_check() */ #define MUTT_MAILBOX_CHECK_FORCE (1 << 0) diff --git a/mx.c b/mx.c index 4db425553..d6d94f04d 100644 --- a/mx.c +++ b/mx.c @@ -392,7 +392,7 @@ void mx_fastclose_mailbox(struct Context *ctx) /* never announce that a mailbox we've just left has new mail. #3290 * TODO: really belongs in mx_mbox_close, but this is a nice hook point */ if (!ctx->peekonly) - mutt_mailbox_setnotified(ctx->mailbox->path); + mutt_mailbox_setnotified(ctx->mailbox); if (ctx->mailbox->mx_ops) ctx->mailbox->mx_ops->mbox_close(ctx);