From d5117de96dd3fd227b87428dfc61b70c1640d4cc Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Wed, 21 Feb 2018 01:22:21 +0000 Subject: [PATCH] fix redundant code --- mutt/mime.h | 8 ++++---- mutt/rfc2047.c | 2 +- ncrypt/crypt_gpgme.c | 4 +--- recvattach.c | 3 +-- rfc3676.c | 2 +- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/mutt/mime.h b/mutt/mime.h index 598e20a23..12e2aa1bd 100644 --- a/mutt/mime.h +++ b/mutt/mime.h @@ -74,10 +74,10 @@ extern const char MimeSpecials[]; #define hexval(c) IndexHex[(unsigned int) (c)] -#define is_multipart(x) \ - ((x)->type == TYPEMULTIPART || \ - ((x)->type == TYPEMESSAGE && ((strcasecmp((x)->subtype, "rfc822") == 0) || \ - (strcasecmp((x)->subtype, "news") == 0)))) +#define is_multipart(x) \ + (((x)->type == TYPEMULTIPART) || (((x)->type == TYPEMESSAGE) && ((x)->subtype) && \ + ((strcasecmp((x)->subtype, "rfc822") == 0) || \ + (strcasecmp((x)->subtype, "news") == 0)))) #define TYPE(X) \ ((X->type == TYPEOTHER) && (X->xtype != NULL) ? X->xtype : BodyTypes[(X->type)]) diff --git a/mutt/rfc2047.c b/mutt/rfc2047.c index af915f37c..2e02c7ffd 100644 --- a/mutt/rfc2047.c +++ b/mutt/rfc2047.c @@ -442,7 +442,7 @@ static int rfc2047_encode(const char *d, size_t dlen, int col, const char *fromc size_t bufpos, buflen; char *u = NULL, *t0 = NULL, *t1 = NULL, *t = NULL; char *s0 = NULL, *s1 = NULL; - size_t ulen, r, n, wlen; + size_t ulen, r, n, wlen = 0; encoder_t encoder; char *tocode1 = NULL; const char *tocode = NULL; diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index 1fc8560b4..051ccee4f 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -2577,9 +2577,7 @@ int pgp_gpgme_application_handler(struct Body *m, struct State *s) if (gpg_err_code(err) == GPG_ERR_NO_DATA) { /* Decrypt verify can't handle signed only messages. */ - err = (gpgme_data_seek(armored_data, 0, SEEK_SET) == -1) ? - gpgme_error_from_errno(errno) : - 0; + gpgme_data_seek(armored_data, 0, SEEK_SET); /* Must release plaintext so that we supply an uninitialized object. */ gpgme_data_release(plaintext); diff --git a/recvattach.c b/recvattach.c index 7303e3f5c..c066a2ad1 100644 --- a/recvattach.c +++ b/recvattach.c @@ -826,7 +826,7 @@ static void print_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, void mutt_print_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, struct Body *top) { - struct State state; + struct State state = { 0 }; pid_t thepid; if (query_quadoption(Print, @@ -839,7 +839,6 @@ void mutt_print_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, stru if (!can_print(actx, top, tag)) return; mutt_endwin(NULL); - memset(&state, 0, sizeof(struct State)); thepid = mutt_create_filter(NONULL(PrintCommand), &state.fpout, NULL, NULL); print_attachment_list(actx, fp, tag, top, &state); mutt_file_fclose(&state.fpout); diff --git a/rfc3676.c b/rfc3676.c index 67d716dfd..4a72a8a72 100644 --- a/rfc3676.c +++ b/rfc3676.c @@ -202,7 +202,7 @@ static void print_flowed_line(char *line, struct State *s, int ql, mutt_debug(4, "f=f: line [%s], width = %ld, spaces = %lu\n", line, (long) width, fst->spaces); - for (p = (char *) line, words = 0; (p = strsep(&line, " ")) != NULL;) + for (words = 0; (p = strsep(&line, " "));) { mutt_debug(4, "f=f: word [%s], width: %lu, remaining = [%s]\n", p, fst->width, line); -- 2.40.0