From 57c7ea57975f65a8883538657d727d795353377b Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Tue, 28 Nov 2017 11:53:18 +0000 Subject: [PATCH] Remove unused parameters * curs_main.c main_change_folder(flags) * imap/imap.c imap_buffy_check(force) * init.c mutt_nm_tag_complete(pos) * ncrypt/crypt_gpgme.c verify_sender(protocol) * recvcmd.c attach_forward_bodies(flags) * mutt/file.c mutt_file_lock(path) * mutt/file.c mutt_file_unlock(path) * recvcmd.c mutt_attach_bounce(hdr) * recvcmd.c mutt_attach_resend(hdr) * recvcmd.c attach_forward_msgs(hdr) * recvcmd.c attach_include_reply(flags) * send.c mutt_make_misc_reply_headers(hdr,ctx) * sendlib.c encode_8bit(istext) --- attach.h | 6 ++---- buffy.c | 2 +- compress.c | 4 ++-- curs_main.c | 12 ++++++------ enter.c | 2 +- hcache/bdb.c | 6 +++--- imap/imap.c | 2 +- imap/imap.h | 2 +- init.c | 2 +- mbox.c | 6 +++--- mutt/file.c | 12 +++++------- mutt/file.h | 4 ++-- ncrypt/crypt_gpgme.c | 4 ++-- newsrc.c | 4 ++-- pager.c | 4 ++-- protos.h | 4 ++-- recvattach.c | 4 ++-- recvcmd.c | 21 ++++++++++----------- send.c | 5 ++--- sendlib.c | 4 ++-- 20 files changed, 52 insertions(+), 58 deletions(-) diff --git a/attach.h b/attach.h index 529056ec79f..f9017a076b6 100644 --- a/attach.h +++ b/attach.h @@ -87,10 +87,8 @@ void mutt_pipe_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, void mutt_print_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, struct Body *top); -void mutt_attach_bounce(FILE *fp, struct Header *hdr, struct AttachCtx *actx, - struct Body *cur); -void mutt_attach_resend(FILE *fp, struct Header *hdr, struct AttachCtx *actx, - struct Body *cur); +void mutt_attach_bounce(FILE *fp, struct AttachCtx *actx, struct Body *cur); +void mutt_attach_resend(FILE *fp, struct AttachCtx *actx, struct Body *cur); void mutt_attach_forward(FILE *fp, struct Header *hdr, struct AttachCtx *actx, struct Body *cur, int flags); void mutt_attach_reply(FILE *fp, struct Header *hdr, struct AttachCtx *actx, diff --git a/buffy.c b/buffy.c index fa483bf39ee..9fda5f74474 100644 --- a/buffy.c +++ b/buffy.c @@ -726,7 +726,7 @@ int mutt_buffy_check(bool force) BuffyNotify = 0; #ifdef USE_IMAP - BuffyCount += imap_buffy_check(force, check_stats); + BuffyCount += imap_buffy_check(check_stats); #endif /* check device ID and serial number instead of comparing paths */ diff --git a/compress.c b/compress.c index 407ee0d20d0..5a30dbe420b 100644 --- a/compress.c +++ b/compress.c @@ -96,7 +96,7 @@ static int lock_realpath(struct Context *ctx, int excl) return 0; } - int r = mutt_file_lock(ctx->realpath, fileno(ci->lockfp), excl, 1); + int r = mutt_file_lock(fileno(ci->lockfp), excl, 1); if (r == 0) ci->locked = 1; @@ -128,7 +128,7 @@ static void unlock_realpath(struct Context *ctx) if (!ci->locked) return; - mutt_file_unlock(ctx->realpath, fileno(ci->lockfp)); + mutt_file_unlock(fileno(ci->lockfp)); ci->locked = 0; mutt_file_fclose(&ci->lockfp); diff --git a/curs_main.c b/curs_main.c index 879a93e445a..4dc126049d5 100644 --- a/curs_main.c +++ b/curs_main.c @@ -435,8 +435,8 @@ void update_index(struct Menu *menu, struct Context *ctx, int check, int oldcoun menu->current = ci_first_message(); } -static int main_change_folder(struct Menu *menu, int op, char *buf, size_t bufsz, - int *oldcount, int *index_hint, int flags) +static int main_change_folder(struct Menu *menu, int op, char *buf, + size_t bufsz, int *oldcount, int *index_hint) { #ifdef USE_NNTP if (option(OPT_NEWS)) @@ -1978,7 +1978,7 @@ int mutt_index_menu(void) if (!nm_uri_from_query(Context, buf, sizeof(buf))) mutt_message(_("Failed to create query, aborting.")); else - main_change_folder(menu, op, buf, sizeof(buf), &oldcount, &index_hint, 0); + main_change_folder(menu, op, buf, sizeof(buf), &oldcount, &index_hint); break; case OP_MAIN_WINDOWED_VFOLDER_BACKWARD: @@ -1998,7 +1998,7 @@ int mutt_index_menu(void) if (!nm_uri_from_query(Context, buf, sizeof(buf))) mutt_message(_("Failed to create query, aborting.")); else - main_change_folder(menu, op, buf, sizeof(buf), &oldcount, &index_hint, 0); + main_change_folder(menu, op, buf, sizeof(buf), &oldcount, &index_hint); break; case OP_MAIN_WINDOWED_VFOLDER_FORWARD: @@ -2019,7 +2019,7 @@ int mutt_index_menu(void) else { mutt_debug(2, "nm: + windowed query (%s)\n", buf); - main_change_folder(menu, op, buf, sizeof(buf), &oldcount, &index_hint, 0); + main_change_folder(menu, op, buf, sizeof(buf), &oldcount, &index_hint); } break; @@ -2142,7 +2142,7 @@ int mutt_index_menu(void) } } - main_change_folder(menu, op, buf, sizeof(buf), &oldcount, &index_hint, flags); + main_change_folder(menu, op, buf, sizeof(buf), &oldcount, &index_hint); #ifdef USE_NNTP /* mutt_buffy_check() must be done with mail-reader mode! */ menu->help = mutt_compile_help( diff --git a/enter.c b/enter.c index b41b4421501..c7df256aec5 100644 --- a/enter.c +++ b/enter.c @@ -623,7 +623,7 @@ int mutt_enter_string_full(char *buf, size_t buflen, int col, int flags, int mul { mutt_mb_wcstombs(buf, buflen, state->wbuf, state->curpos); i = strlen(buf); - if (!mutt_nm_tag_complete(buf, buflen, i, state->tabs)) + if (!mutt_nm_tag_complete(buf, buflen, state->tabs)) BEEP(); replace_part(state, 0, buf); diff --git a/hcache/bdb.c b/hcache/bdb.c index 68bb8810335..10bb476709b 100644 --- a/hcache/bdb.c +++ b/hcache/bdb.c @@ -91,7 +91,7 @@ static void *hcache_bdb_open(const char *path) return NULL; } - if (mutt_file_lock(ctx->lockfile, ctx->fd, 1, 5)) + if (mutt_file_lock(ctx->fd, 1, 5)) goto fail_close; ret = db_env_create(&ctx->env, 0); @@ -124,7 +124,7 @@ static void *hcache_bdb_open(const char *path) fail_env: ctx->env->close(ctx->env, 0); fail_unlock: - mutt_file_unlock(ctx->lockfile, ctx->fd); + mutt_file_unlock(ctx->fd); fail_close: close(ctx->fd); unlink(ctx->lockfile); @@ -199,7 +199,7 @@ static void hcache_bdb_close(void **vctx) ctx->db->close(ctx->db, 0); ctx->env->close(ctx->env, 0); - mutt_file_unlock(ctx->lockfile, ctx->fd); + mutt_file_unlock(ctx->fd); close(ctx->fd); unlink(ctx->lockfile); FREE(vctx); diff --git a/imap/imap.c b/imap/imap.c index e1fbb93a5ea..6107b82295a 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -1472,7 +1472,7 @@ int imap_check(struct ImapData *idata, int force) * batch the commands and save on round trips. Returns number of mailboxes with * new mail. */ -int imap_buffy_check(int force, int check_stats) +int imap_buffy_check(int check_stats) { struct ImapData *idata = NULL; struct ImapData *lastdata = NULL; diff --git a/imap/imap.h b/imap/imap.h index 94fb2c8925d..a3d5ff691f6 100644 --- a/imap/imap.h +++ b/imap/imap.h @@ -68,7 +68,7 @@ int imap_access(const char *path); int imap_check_mailbox(struct Context *ctx, int force); int imap_delete_mailbox(struct Context *ctx, struct ImapMbox *mx); int imap_sync_mailbox(struct Context *ctx, int expunge); -int imap_buffy_check(int force, int check_stats); +int imap_buffy_check(int check_stats); int imap_status(char *path, int queue); int imap_search(struct Context *ctx, const struct Pattern *pat); int imap_subscribe(char *path, bool subscribe); diff --git a/init.c b/init.c index 4d2e7d1ef3c..b4a71221d48 100644 --- a/init.c +++ b/init.c @@ -3737,7 +3737,7 @@ bool mutt_nm_query_complete(char *buffer, size_t len, int pos, int numtabs) * * Complete the nearest "+" or "-" -prefixed string previous to pos. */ -bool mutt_nm_tag_complete(char *buffer, size_t len, int pos, int numtabs) +bool mutt_nm_tag_complete(char *buffer, size_t len, int numtabs) { if (!buffer) return false; diff --git a/mbox.c b/mbox.c index 456e9606bc4..26e4f85cd41 100644 --- a/mbox.c +++ b/mbox.c @@ -74,7 +74,7 @@ static int mbox_lock_mailbox(struct Context *ctx, int excl, int retry) { int r; - r = mutt_file_lock(ctx->path, fileno(ctx->fp), excl, retry); + r = mutt_file_lock(fileno(ctx->fp), excl, retry); if (r == 0) ctx->locked = true; else if (retry && !excl) @@ -92,7 +92,7 @@ static void mbox_unlock_mailbox(struct Context *ctx) { fflush(ctx->fp); - mutt_file_unlock(ctx->path, fileno(ctx->fp)); + mutt_file_unlock(fileno(ctx->fp)); ctx->locked = false; } } @@ -496,7 +496,7 @@ static int mbox_close_mailbox(struct Context *ctx) if (ctx->append) { - mutt_file_unlock(ctx->path, fileno(ctx->fp)); + mutt_file_unlock(fileno(ctx->fp)); mutt_sig_unblock(); } diff --git a/mutt/file.c b/mutt/file.c index c16fc06c254..a9c67791524 100644 --- a/mutt/file.c +++ b/mutt/file.c @@ -1089,7 +1089,6 @@ int mutt_file_chmod_rm_stat(const char *path, mode_t mode, struct stat *st) /** * mutt_file_lock - (try to) lock a file - * @param path Path to file * @param fd File descriptor to file * @param excl If set, try to lock exclusively * @param timeout Retry after this time @@ -1101,7 +1100,7 @@ int mutt_file_chmod_rm_stat(const char *path, mode_t mode, struct stat *st) * * Use mutt_file_unlock() to unlock the file. */ -int mutt_file_lock(const char *path, int fd, int excl, int timeout) +int mutt_file_lock(int fd, int excl, int timeout) { #if defined(USE_FCNTL) || defined(USE_FLOCK) int count; @@ -1201,11 +1200,10 @@ int mutt_file_lock(const char *path, int fd, int excl, int timeout) /** * mutt_file_unlock - Unlock a file previously locked by mutt_file_lock() - * @param path Path to file - * @param fd File descriptor to file + * @param fd File descriptor to file * @retval 0 Always */ -int mutt_file_unlock(const char *path, int fd) +int mutt_file_unlock(int fd) { #ifdef USE_FCNTL struct flock unlockit = { F_UNLCK, 0, 0, 0, 0 }; @@ -1236,7 +1234,7 @@ void mutt_file_unlink_empty(const char *path) if (fd == -1) return; - if (mutt_file_lock(path, fd, 1, 1) == -1) + if (mutt_file_lock(fd, 1, 1) == -1) { close(fd); return; @@ -1245,7 +1243,7 @@ void mutt_file_unlink_empty(const char *path) if (fstat(fd, &sb) == 0 && sb.st_size == 0) unlink(path); - mutt_file_unlock(path, fd); + mutt_file_unlock(fd); close(fd); } diff --git a/mutt/file.h b/mutt/file.h index bec2dd38246..f6da93bde20 100644 --- a/mutt/file.h +++ b/mutt/file.h @@ -49,7 +49,7 @@ const char *mutt_file_dirname(const char *p); int mutt_file_fclose(FILE **f); FILE * mutt_file_fopen(const char *path, const char *mode); int mutt_file_fsync_close(FILE **f); -int mutt_file_lock(const char *path, int fd, int excl, int timeout); +int mutt_file_lock(int fd, int excl, int timeout); int mutt_file_mkdir(const char *path, mode_t mode); int mutt_file_open(const char *path, int flags); size_t mutt_file_quote_filename(char *d, size_t l, const char *f); @@ -66,6 +66,6 @@ int mutt_file_to_absolute_path(char *path, const char *reference); void mutt_file_touch_atime(int f); void mutt_file_unlink(const char *s); void mutt_file_unlink_empty(const char *path); -int mutt_file_unlock(const char *path, int fd); +int mutt_file_unlock(int fd); #endif /* _MUTT_FILE_H */ diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index b493cfb6fb4..711eb2427c4 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -5034,7 +5034,7 @@ int smime_gpgme_send_menu(struct Header *msg) return gpgme_send_menu(msg, 1); } -static int verify_sender(struct Header *h, gpgme_protocol_t protocol) +static int verify_sender(struct Header *h) { struct Address *sender = NULL; unsigned int rc = 1; @@ -5114,7 +5114,7 @@ static int verify_sender(struct Header *h, gpgme_protocol_t protocol) int smime_gpgme_verify_sender(struct Header *h) { - return verify_sender(h, GPGME_PROTOCOL_CMS); + return verify_sender(h); } void mutt_gpgme_set_sender(const char *sender) diff --git a/newsrc.c b/newsrc.c index 80813d93bf9..bbcad45355f 100644 --- a/newsrc.c +++ b/newsrc.c @@ -124,7 +124,7 @@ void nntp_newsrc_close(struct NntpServer *nserv) return; mutt_debug(1, "Unlocking %s\n", nserv->newsrc_file); - mutt_file_unlock(nserv->newsrc_file, fileno(nserv->newsrc_fp)); + mutt_file_unlock(fileno(nserv->newsrc_fp)); mutt_file_fclose(&nserv->newsrc_fp); } @@ -188,7 +188,7 @@ int nntp_newsrc_parse(struct NntpServer *nserv) /* lock it */ mutt_debug(1, "Locking %s\n", nserv->newsrc_file); - if (mutt_file_lock(nserv->newsrc_file, fileno(nserv->newsrc_fp), 0, 1)) + if (mutt_file_lock(fileno(nserv->newsrc_fp), 0, 1)) { mutt_file_fclose(&nserv->newsrc_fp); return -1; diff --git a/pager.c b/pager.c index 183ef3cb858..61ccfbf9e5b 100644 --- a/pager.c +++ b/pager.c @@ -2710,7 +2710,7 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e CHECK_MODE(IsHeader(extra) || IsMsgAttach(extra)) CHECK_ATTACH; if (IsMsgAttach(extra)) - mutt_attach_bounce(extra->fp, extra->hdr, extra->actx, extra->bdy); + mutt_attach_bounce(extra->fp, extra->actx, extra->bdy); else ci_bounce_message(extra->hdr); break; @@ -2719,7 +2719,7 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e CHECK_MODE(IsHeader(extra) || IsMsgAttach(extra)) CHECK_ATTACH; if (IsMsgAttach(extra)) - mutt_attach_resend(extra->fp, extra->hdr, extra->actx, extra->bdy); + mutt_attach_resend(extra->fp, extra->actx, extra->bdy); else mutt_resend_message(NULL, extra->ctx, extra->hdr); pager_menu->redraw = REDRAW_FULL; diff --git a/protos.h b/protos.h index cbe806e1825..d32d4a86bac 100644 --- a/protos.h +++ b/protos.h @@ -196,7 +196,7 @@ void mutt_check_lookup_list(struct Body *b, char *type, int len); void mutt_make_attribution(struct Context *ctx, struct Header *cur, FILE *out); void mutt_make_forward_subject(struct Envelope *env, struct Context *ctx, struct Header *cur); void mutt_make_help(char *d, size_t dlen, const char *txt, int menu, int op); -void mutt_make_misc_reply_headers(struct Envelope *env, struct Context *ctx, struct Header *cur, struct Envelope *curenv); +void mutt_make_misc_reply_headers(struct Envelope *env, struct Envelope *curenv); void mutt_make_post_indent(struct Context *ctx, struct Header *cur, FILE *out); void mutt_message_to_7bit(struct Body *a, FILE *fp); void mutt_mktemp_full(char *s, size_t slen, const char *prefix, const char *suffix, const char *src, int line); @@ -257,7 +257,7 @@ int mutt_command_complete(char *buffer, size_t len, int pos, int numtabs); int mutt_var_value_complete(char *buffer, size_t len, int pos); #ifdef USE_NOTMUCH bool mutt_nm_query_complete(char *buffer, size_t len, int pos, int numtabs); -bool mutt_nm_tag_complete(char *buffer, size_t len, int pos, int numtabs); +bool mutt_nm_tag_complete(char *buffer, size_t len, int numtabs); #endif int mutt_complete(char *s, size_t slen); int mutt_compose_attachment(struct Body *a); diff --git a/recvattach.c b/recvattach.c index 2ec2603a702..9daa9b00967 100644 --- a/recvattach.c +++ b/recvattach.c @@ -1350,14 +1350,14 @@ void mutt_view_attachments(struct Header *hdr) case OP_RESEND: CHECK_ATTACH; - mutt_attach_resend(CURATTACH->fp, hdr, actx, + mutt_attach_resend(CURATTACH->fp, actx, menu->tagprefix ? NULL : CURATTACH->content); menu->redraw = REDRAW_FULL; break; case OP_BOUNCE_MESSAGE: CHECK_ATTACH; - mutt_attach_bounce(CURATTACH->fp, hdr, actx, + mutt_attach_bounce(CURATTACH->fp, actx, menu->tagprefix ? NULL : CURATTACH->content); menu->redraw = REDRAW_FULL; break; diff --git a/recvcmd.c b/recvcmd.c index 8ff06b073b1..4fc2167a5d9 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -119,7 +119,7 @@ static short count_tagged_children(struct AttachCtx *actx, short i) /** * mutt_attach_bounce - Bounce function, from the attachment menu */ -void mutt_attach_bounce(FILE *fp, struct Header *hdr, struct AttachCtx *actx, struct Body *cur) +void mutt_attach_bounce(FILE *fp, struct AttachCtx *actx, struct Body *cur) { char prompt[STRING]; char buf[HUGE_STRING]; @@ -241,7 +241,7 @@ void mutt_attach_bounce(FILE *fp, struct Header *hdr, struct AttachCtx *actx, st /** * mutt_attach_resend - resend-message, from the attachment menu */ -void mutt_attach_resend(FILE *fp, struct Header *hdr, struct AttachCtx *actx, struct Body *cur) +void mutt_attach_resend(FILE *fp, struct AttachCtx *actx, struct Body *cur) { if (!check_all_msg(actx, cur, true)) return; @@ -377,7 +377,7 @@ static struct Body **copy_problematic_attachments(struct Body **last, * (non-message types) */ static void attach_forward_bodies(FILE *fp, struct Header *hdr, struct AttachCtx *actx, - struct Body *cur, short nattach, int flags) + struct Body *cur, short nattach) { bool mime_fwd_all = false; bool mime_fwd_any = true; @@ -556,8 +556,7 @@ static void attach_forward_bodies(FILE *fp, struct Header *hdr, struct AttachCtx * relies on a context structure to find messages, while, on the attachment * menu, messages are referenced through the attachment index. */ -static void attach_forward_msgs(FILE *fp, struct Header *hdr, - struct AttachCtx *actx, struct Body *cur, int flags) +static void attach_forward_msgs(FILE *fp, struct AttachCtx *actx, struct Body *cur, int flags) { struct Header *curhdr = NULL; struct Header *tmphdr = NULL; @@ -670,11 +669,11 @@ void mutt_attach_forward(FILE *fp, struct Header *hdr, struct AttachCtx *actx, short nattach; if (check_all_msg(actx, cur, false)) - attach_forward_msgs(fp, hdr, actx, cur, flags); + attach_forward_msgs(fp, actx, cur, flags); else { nattach = count_tagged(actx); - attach_forward_bodies(fp, hdr, actx, cur, nattach, flags); + attach_forward_bodies(fp, hdr, actx, cur, nattach); } } @@ -763,7 +762,7 @@ static int attach_reply_envelope_defaults(struct Envelope *env, struct AttachCtx mutt_fix_reply_recipients(env); } - mutt_make_misc_reply_headers(env, Context, curhdr, curenv); + mutt_make_misc_reply_headers(env, curenv); if (parent) mutt_add_to_reference_headers(env, curenv); @@ -782,7 +781,7 @@ static int attach_reply_envelope_defaults(struct Envelope *env, struct AttachCtx /** * attach_include_reply - This is _very_ similar to send.c's include_reply() */ -static void attach_include_reply(FILE *fp, FILE *tmpfp, struct Header *cur, int flags) +static void attach_include_reply(FILE *fp, FILE *tmpfp, struct Header *cur) { int cmflags = MUTT_CM_PREFIX | MUTT_CM_DECODE | MUTT_CM_CHARCONV; int chflags = CH_DECODE; @@ -876,13 +875,13 @@ void mutt_attach_reply(FILE *fp, struct Header *hdr, struct AttachCtx *actx, if (!parent_hdr) { if (cur) - attach_include_reply(fp, tmpfp, cur->hdr, flags); + attach_include_reply(fp, tmpfp, cur->hdr); else { for (short i = 0; i < actx->idxlen; i++) { if (actx->idx[i]->content->tagged) - attach_include_reply(actx->idx[i]->fp, tmpfp, actx->idx[i]->content->hdr, flags); + attach_include_reply(actx->idx[i]->fp, tmpfp, actx->idx[i]->content->hdr); } } } diff --git a/send.c b/send.c index d3d320fb6b4..032f7eab13a 100644 --- a/send.c +++ b/send.c @@ -709,8 +709,7 @@ void mutt_make_forward_subject(struct Envelope *env, struct Context *ctx, struct mutt_str_replace(&env->subject, buffer); } -void mutt_make_misc_reply_headers(struct Envelope *env, struct Context *ctx, - struct Header *cur, struct Envelope *curenv) +void mutt_make_misc_reply_headers(struct Envelope *env, struct Envelope *curenv) { if (!env || !curenv) return; @@ -835,7 +834,7 @@ static int envelope_defaults(struct Envelope *env, struct Context *ctx, return -1; } - mutt_make_misc_reply_headers(env, ctx, cur, curenv); + mutt_make_misc_reply_headers(env, curenv); make_reference_headers(tag ? NULL : curenv, env, ctx); } else if (flags & SENDFORWARD) diff --git a/sendlib.c b/sendlib.c index c0a3cacb61d..073473dca66 100644 --- a/sendlib.c +++ b/sendlib.c @@ -298,7 +298,7 @@ static void encode_base64(FGETCONV *fc, FILE *fout, int istext) fputc('\n', fout); } -static void encode_8bit(FGETCONV *fc, FILE *fout, int istext) +static void encode_8bit(FGETCONV *fc, FILE *fout) { int ch; @@ -488,7 +488,7 @@ int mutt_write_mime_body(struct Body *a, FILE *f) else if (a->encoding == ENCBASE64) encode_base64(fc, f, write_as_text_part(a)); else if (a->type == TYPETEXT && (!a->noconv)) - encode_8bit(fc, f, write_as_text_part(a)); + encode_8bit(fc, f); else mutt_file_copy_stream(fpin, f); mutt_sig_allow_interrupt(0);