From: Damien Riegel Date: Thu, 26 May 2016 21:05:39 +0000 (-0700) Subject: mx_check_mailbox: remove lock argument in function call X-Git-Tag: neomutt-20160822~142 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=52b69857d5251345319da3ebabe8d8d490bb8cf9;p=neomutt mx_check_mailbox: remove lock argument in function call This function is only called in one place with lock = 0. Basically, all code under if (lock) is dead code, so we can remove it, making the function simpler to factorize. --- diff --git a/curs_main.c b/curs_main.c index d49b73e61..f5ac2458c 100644 --- a/curs_main.c +++ b/curs_main.c @@ -549,7 +549,7 @@ int mutt_index_menu (void) index_hint = (Context->vcount && menu->current >= 0 && menu->current < Context->vcount) ? CURHDR->index : 0; - if ((check = mx_check_mailbox (Context, &index_hint, 0)) < 0) + if ((check = mx_check_mailbox (Context, &index_hint)) < 0) { if (!Context->path) { diff --git a/mailbox.h b/mailbox.h index f61e5865f..8d35c4d6d 100644 --- a/mailbox.h +++ b/mailbox.h @@ -69,7 +69,7 @@ int mx_commit_message (MESSAGE *, CONTEXT *); int mx_close_message (MESSAGE **); int mx_get_magic (const char *); int mx_set_magic (const char *); -int mx_check_mailbox (CONTEXT *, int *, int); +int mx_check_mailbox (CONTEXT *, int *); #ifdef USE_IMAP int mx_is_imap (const char *); #endif diff --git a/mx.c b/mx.c index cf50d538a..f8d27aba4 100644 --- a/mx.c +++ b/mx.c @@ -1262,40 +1262,15 @@ MESSAGE *mx_open_new_message (CONTEXT *dest, HEADER *hdr, int flags) } /* check for new mail */ -int mx_check_mailbox (CONTEXT *ctx, int *index_hint, int lock) +int mx_check_mailbox (CONTEXT *ctx, int *index_hint) { - int rc; - if (ctx) { - if (ctx->locked) lock = 0; - switch (ctx->magic) { case MUTT_MBOX: case MUTT_MMDF: - - if (lock) - { - mutt_block_signals (); - if (mbox_lock_mailbox (ctx, 0, 0) == -1) - { - mutt_unblock_signals (); - return MUTT_LOCKED; - } - } - - rc = mbox_check_mailbox (ctx, index_hint); - - if (lock) - { - mutt_unblock_signals (); - mbox_unlock_mailbox (ctx); - } - - return rc; - - + return mbox_check_mailbox (ctx, index_hint); case MUTT_MH: return (mh_check_mailbox (ctx, index_hint)); case MUTT_MAILDIR: