Commit 127fd406 authored by Damien Riegel's avatar Damien Riegel

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.
parent ad05fc2d
......@@ -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)
{
......
......@@ -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
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment