From e80b81960b97eabc00a7e96a5d07be8d223f19e9 Mon Sep 17 00:00:00 2001 From: Bertram Scharpf Date: Wed, 27 Jun 2018 15:51:26 +0200 Subject: [PATCH] Remove parentheses from all return statments `return` is a statement, not a function. --- addrbook.c | 2 +- alias.c | 2 +- browser.c | 22 +++---- color.c | 4 +- complete.c | 4 +- compress.c | 4 +- conn/socket.c | 4 +- conn/ssl.c | 4 +- conn/ssl_gnutls.c | 2 +- curs_lib.c | 4 +- curs_main.c | 2 +- edit.c | 2 +- email/address.c | 6 +- email/parse.c | 4 +- email/rfc2047.c | 8 +-- email/rfc2231.c | 4 +- filter.c | 2 +- group.c | 2 +- handler.c | 2 +- hcache/hcache.c | 4 +- hdrline.c | 8 +-- help.c | 8 +-- imap/command.c | 2 +- init.c | 13 ++-- keymap.c | 10 +-- maildir/mh.c | 8 +-- mbox/mbox.c | 2 +- menu.c | 2 +- mutt/base64.c | 2 +- mutt/buffer.c | 2 +- mutt/charset.c | 4 +- mutt/date.c | 8 +-- mutt/file.c | 13 ++-- mutt/hash.c | 2 +- mutt/history.c | 2 +- mutt/logging.c | 2 +- mutt/mbyte.c | 4 +- mutt/string.c | 2 +- mutt_account.c | 6 +- mutt_attach.c | 2 +- mutt_logging.c | 2 +- mutt_thread.c | 10 +-- muttlib.c | 4 +- mx.c | 2 +- ncrypt/crypt.c | 6 +- ncrypt/crypt_gpgme.c | 28 ++++---- ncrypt/pgp.c | 4 +- ncrypt/pgpkey.c | 40 ++++++------ pager.c | 4 +- pattern.c | 150 +++++++++++++++++++++---------------------- pop/pop.c | 2 +- postpone.c | 4 +- query.c | 2 +- recvattach.c | 2 +- rfc3676.c | 2 +- sendlib.c | 14 ++-- sidebar.c | 4 +- sort.c | 36 +++++------ test/acutest.h | 2 +- 59 files changed, 256 insertions(+), 252 deletions(-) diff --git a/addrbook.c b/addrbook.c index fa885ebf744..731b960ca89 100644 --- a/addrbook.c +++ b/addrbook.c @@ -145,7 +145,7 @@ static int alias_tag(struct Menu *menu, int n, int m) cur->tagged = (m >= 0 ? m : !cur->tagged); - return (cur->tagged - ot); + return cur->tagged - ot; } /** diff --git a/alias.c b/alias.c index 61b7e44ec2c..0fdb24e8eef 100644 --- a/alias.c +++ b/alias.c @@ -288,7 +288,7 @@ struct Address *mutt_expand_aliases(struct Address *a) STAILQ_INIT(&expn); t = expand_aliases_r(a, &expn); mutt_list_free(&expn); - return (mutt_remove_duplicates(t)); + return mutt_remove_duplicates(t); } /** diff --git a/browser.c b/browser.c index 5fb15a77447..edb6f7c6744 100644 --- a/browser.c +++ b/browser.c @@ -138,7 +138,7 @@ static int browser_compare_subject(const void *a, const void *b) int r = mutt_inbox_cmp(pa->name, pb->name); if (r == 0) r = mutt_str_strcoll(pa->name, pb->name); - return ((SortBrowser & SORT_REVERSE) ? -r : r); + return (SortBrowser & SORT_REVERSE) ? -r : r; } static int browser_compare_desc(const void *a, const void *b) @@ -148,7 +148,7 @@ static int browser_compare_desc(const void *a, const void *b) int r = mutt_str_strcoll(pa->desc, pb->desc); - return ((SortBrowser & SORT_REVERSE) ? -r : r); + return (SortBrowser & SORT_REVERSE) ? -r : r; } static int browser_compare_date(const void *a, const void *b) @@ -158,7 +158,7 @@ static int browser_compare_date(const void *a, const void *b) int r = pa->mtime - pb->mtime; - return ((SortBrowser & SORT_REVERSE) ? -r : r); + return (SortBrowser & SORT_REVERSE) ? -r : r; } static int browser_compare_size(const void *a, const void *b) @@ -168,7 +168,7 @@ static int browser_compare_size(const void *a, const void *b) int r = pa->size - pb->size; - return ((SortBrowser & SORT_REVERSE) ? -r : r); + return (SortBrowser & SORT_REVERSE) ? -r : r; } static int browser_compare_count(const void *a, const void *b) @@ -184,7 +184,7 @@ static int browser_compare_count(const void *a, const void *b) else r = 1; - return ((SortBrowser & SORT_REVERSE) ? -r : r); + return (SortBrowser & SORT_REVERSE) ? -r : r; } static int browser_compare_count_new(const void *a, const void *b) @@ -200,7 +200,7 @@ static int browser_compare_count_new(const void *a, const void *b) else r = 1; - return ((SortBrowser & SORT_REVERSE) ? -r : r); + return (SortBrowser & SORT_REVERSE) ? -r : r; } /** @@ -278,7 +278,7 @@ static int link_is_dir(const char *folder, const char *path) mutt_file_concat_path(fullpath, folder, path, sizeof(fullpath)); if (stat(fullpath, &st) == 0) - return (S_ISDIR(st.st_mode)); + return S_ISDIR(st.st_mode); else return 0; } @@ -979,15 +979,15 @@ static int select_file_search(struct Menu *menu, regex_t *re, int n) { #ifdef USE_NNTP if (OptNews) - return (regexec(re, ((struct FolderFile *) menu->data)[n].desc, 0, NULL, 0)); + return regexec(re, ((struct FolderFile *) menu->data)[n].desc, 0, NULL, 0); #endif - return (regexec(re, ((struct FolderFile *) menu->data)[n].name, 0, NULL, 0)); + return regexec(re, ((struct FolderFile *) menu->data)[n].name, 0, NULL, 0); } #ifdef USE_NOTMUCH static int select_vfolder_search(struct Menu *menu, regex_t *re, int n) { - return (regexec(re, ((struct FolderFile *) menu->data)[n].desc, 0, NULL, 0)); + return regexec(re, ((struct FolderFile *) menu->data)[n].desc, 0, NULL, 0); } #endif @@ -1168,7 +1168,7 @@ static int file_tag(struct Menu *menu, int n, int m) bool ot = ff->tagged; ff->tagged = (m >= 0 ? m : !ff->tagged); - return (ff->tagged - ot); + return ff->tagged - ot; } /** diff --git a/color.c b/color.c index f2564af49fd..a888725b1a8 100644 --- a/color.c +++ b/color.c @@ -251,7 +251,7 @@ int mutt_alloc_color(int fg, int bg) if (p->fg == fg && p->bg == bg) { (p->count)++; - return (COLOR_PAIR(p->index)); + return COLOR_PAIR(p->index); } p = p->next; } @@ -304,7 +304,7 @@ int mutt_alloc_color(int fg, int bg) mutt_debug(3, "Color pairs used so far: %d\n", UserColors); - return (COLOR_PAIR(p->index)); + return COLOR_PAIR(p->index); } static int mutt_lookup_color(short pair, short *fg, short *bg) diff --git a/complete.c b/complete.c index 20118836e39..5b1f04159f0 100644 --- a/complete.c +++ b/complete.c @@ -124,7 +124,7 @@ int mutt_complete(char *buf, size_t buflen) } mutt_str_strfcpy(buf, filepart, buflen); - return (init ? 0 : -1); + return init ? 0 : -1; } #endif @@ -279,5 +279,5 @@ int mutt_complete(char *buf, size_t buflen) else mutt_str_strfcpy(buf, filepart, buflen); - return (init ? 0 : -1); + return init ? 0 : -1; } diff --git a/compress.c b/compress.c index 8884531af21..0a4fcc58963 100644 --- a/compress.c +++ b/compress.c @@ -115,7 +115,7 @@ static int lock_realpath(struct Context *ctx, int excl) return 1; } - return (r == 0); + return r == 0; } /** @@ -903,7 +903,7 @@ int mutt_comp_valid_command(const char *cmd) if (!cmd) return 0; - return (strstr(cmd, "%f") && strstr(cmd, "%t")); + return strstr(cmd, "%f") && strstr(cmd, "%t"); } // clang-format off diff --git a/conn/socket.c b/conn/socket.c index b6f81d7a397..2e9953b0e8a 100644 --- a/conn/socket.c +++ b/conn/socket.c @@ -210,7 +210,7 @@ int mutt_socket_write_d(struct Connection *conn, const char *buf, int len, int d int mutt_socket_poll(struct Connection *conn, time_t wait_secs) { if (conn->bufpos < conn->available) - return (conn->available - conn->bufpos); + return conn->available - conn->bufpos; if (conn->conn_poll) return conn->conn_poll(conn, wait_secs); @@ -287,7 +287,7 @@ int mutt_socket_readln_d(char *buf, size_t buflen, struct Connection *conn, int mutt_debug(dbg, "%d< %s\n", conn->fd, buf); /* number of bytes read, not strlen */ - return (i + 1); + return i + 1; } /** diff --git a/conn/ssl.c b/conn/ssl.c index fcab31401aa..27f749212a4 100644 --- a/conn/ssl.c +++ b/conn/ssl.c @@ -923,7 +923,7 @@ static int ssl_cache_trusted_cert(X509 *c) mutt_debug(1, "trusted\n"); if (!SslSessionCerts) SslSessionCerts = sk_X509_new_null(); - return (sk_X509_push(SslSessionCerts, X509_dup(c))); + return sk_X509_push(SslSessionCerts, X509_dup(c)); } /** @@ -1095,7 +1095,7 @@ static int interactive_check_cert(X509 *cert, int idx, size_t len, SSL *ssl, int mutt_menu_pop_current(menu); mutt_menu_destroy(&menu); mutt_debug(2, "done=%d\n", done); - return (done == 2); + return done == 2; } /** diff --git a/conn/ssl_gnutls.c b/conn/ssl_gnutls.c index 6d4a035f6cc..ce0625c32c5 100644 --- a/conn/ssl_gnutls.c +++ b/conn/ssl_gnutls.c @@ -862,7 +862,7 @@ static int tls_check_one_certificate(const gnutls_datum_t *certdata, mutt_menu_destroy(&menu); gnutls_x509_crt_deinit(cert); - return (done == 2); + return done == 2; } /** diff --git a/curs_lib.c b/curs_lib.c index e3b47ab5a6c..b3516d2e86f 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -162,7 +162,7 @@ struct Event mutt_getch(void) ret.ch = ch; ret.op = 0; - return (ch == ctrl('G') ? err : ret); + return ch == ctrl('G') ? err : ret; } int mutt_get_field_full(const char *field, char *buf, size_t buflen, @@ -1054,7 +1054,7 @@ bool message_is_visible(struct Context *ctx, int index) if (!ctx || !ctx->hdrs || (index >= ctx->msgcount)) return false; - return (!ctx->pattern || ctx->hdrs[index]->limited); + return !ctx->pattern || ctx->hdrs[index]->limited; } /** diff --git a/curs_main.c b/curs_main.c index ab839e13c0d..b0bad9ff314 100644 --- a/curs_main.c +++ b/curs_main.c @@ -282,7 +282,7 @@ static int ci_first_message(void) } else { - return (Context->vcount ? Context->vcount - 1 : 0); + return Context->vcount ? Context->vcount - 1 : 0; } return 0; diff --git a/edit.c b/edit.c index 29db5922fd1..d9099eca885 100644 --- a/edit.c +++ b/edit.c @@ -504,5 +504,5 @@ int mutt_builtin_editor(const char *path, struct Header *msg, struct Header *cur be_barf_file(path, buf, buflen); be_free_memory(buf, buflen); - return (abort ? -1 : 0); + return abort ? -1 : 0; } diff --git a/email/address.c b/email/address.c index 2dee87dd8a7..2955ac7a157 100644 --- a/email/address.c +++ b/email/address.c @@ -145,7 +145,7 @@ static const char *parse_quote(const char *s, char *token, size_t *tokenlen, siz token[*tokenlen] = *s; } else if (*s == '"') - return (s + 1); + return s + 1; (*tokenlen)++; s++; } @@ -171,7 +171,7 @@ static const char *next_token(const char *s, char *token, size_t *tokenlen, size { if (*tokenlen < tokenmax) token[(*tokenlen)++] = *s; - return (s + 1); + return s + 1; } while (*s) { @@ -1184,7 +1184,7 @@ size_t mutt_addr_write(char *buf, size_t buflen, struct Address *addr, bool disp } done: *pbuf = 0; - return (pbuf - buf); + return pbuf - buf; } /** diff --git a/email/parse.c b/email/parse.c index bbd16a90213..7e4dd80b397 100644 --- a/email/parse.c +++ b/email/parse.c @@ -1205,8 +1205,8 @@ bool mutt_is_message_type(int type, const char *subtype) return false; subtype = NONULL(subtype); - return ((mutt_str_strcasecmp(subtype, "rfc822") == 0) || - (mutt_str_strcasecmp(subtype, "news") == 0)); + return (mutt_str_strcasecmp(subtype, "rfc822") == 0) || + (mutt_str_strcasecmp(subtype, "news") == 0); } /** diff --git a/email/rfc2047.c b/email/rfc2047.c index 35125fcdd16..5a222ed2528 100644 --- a/email/rfc2047.c +++ b/email/rfc2047.c @@ -85,7 +85,7 @@ static size_t b_encoder(char *str, const char *buf, size_t buflen, const char *t memcpy(str, "?=", 2); str += 2; - return (str - s0); + return str - s0; } /** @@ -123,7 +123,7 @@ static size_t q_encoder(char *str, const char *buf, size_t buflen, const char *t } memcpy(str, "?=", 2); str += 2; - return (str - s0); + return str - s0; } /** @@ -173,7 +173,7 @@ static char *parse_encoded_word(char *str, enum ContentEncoding *enc, char **cha *text = str + match[3].rm_so; *textlen = match[3].rm_eo - match[3].rm_so; - return (str + match[0].rm_so); + return str + match[0].rm_so; } /** @@ -225,7 +225,7 @@ static size_t try_block(const char *d, size_t dlen, const char *fromcode, else { if (dlen > (sizeof(buf) - strlen(tocode))) - return (sizeof(buf) - strlen(tocode) + 1); + return sizeof(buf) - strlen(tocode) + 1; memcpy(buf, d, dlen); ob = buf + dlen; } diff --git a/email/rfc2231.c b/email/rfc2231.c index a02678ae623..97056e3e89e 100644 --- a/email/rfc2231.c +++ b/email/rfc2231.c @@ -98,9 +98,9 @@ static char *get_charset(char *value, char *charset, size_t chslen) char *u = strchr(t + 1, '\''); if (u) - return (u + 1); + return u + 1; else - return (t + 1); + return t + 1; } /** diff --git a/filter.c b/filter.c index 697b94dae3c..6978f9cc548 100644 --- a/filter.c +++ b/filter.c @@ -212,7 +212,7 @@ pid_t mutt_create_filter_fd(const char *cmd, FILE **in, FILE **out, FILE **err, */ pid_t mutt_create_filter(const char *s, FILE **in, FILE **out, FILE **err) { - return (mutt_create_filter_fd(s, in, out, err, -1, -1, -1)); + return mutt_create_filter_fd(s, in, out, err, -1, -1, -1); } /** diff --git a/group.c b/group.c index 103cf489595..795d95accc3 100644 --- a/group.c +++ b/group.c @@ -76,7 +76,7 @@ static int empty_group(struct Group *g) { if (!g) return -1; - return (!g->as && !g->rs); + return !g->as && !g->rs; } void mutt_group_context_add(struct GroupContext **ctx, struct Group *group) diff --git a/handler.c b/handler.c index 49fdb0853d6..b1435bd81c7 100644 --- a/handler.c +++ b/handler.c @@ -345,7 +345,7 @@ static unsigned char decode_byte(char ch) { if (ch == 96) return 0; - return (ch - 32); + return ch - 32; } /** diff --git a/hcache/hcache.c b/hcache/hcache.c index 21d01829689..a3cc1e9cc1b 100644 --- a/hcache/hcache.c +++ b/hcache/hcache.c @@ -132,7 +132,7 @@ static bool crc_matches(const char *d, unsigned int crc) unsigned int mycrc = *(unsigned int *) (d + sizeof(union Validate)); - return (crc == mycrc); + return crc == mycrc; } /** @@ -485,5 +485,5 @@ const char *mutt_hcache_backend_list(void) */ bool mutt_hcache_is_valid_backend(const char *s) { - return (hcache_get_backend_ops(s) != NULL); + return hcache_get_backend_ops(s) != NULL; } diff --git a/hdrline.c b/hdrline.c index d36340a3676..10f10c9f27b 100644 --- a/hdrline.c +++ b/hdrline.c @@ -406,14 +406,14 @@ static char *apply_subject_mods(struct Envelope *env) static bool thread_is_new(struct Context *ctx, struct Header *hdr) { - return (hdr->collapsed && (hdr->num_hidden > 1) && - (mutt_thread_contains_unread(ctx, hdr) == 1)); + return hdr->collapsed && (hdr->num_hidden > 1) && + (mutt_thread_contains_unread(ctx, hdr) == 1); } static bool thread_is_old(struct Context *ctx, struct Header *hdr) { - return (hdr->collapsed && (hdr->num_hidden > 1) && - (mutt_thread_contains_unread(ctx, hdr) == 2)); + return hdr->collapsed && (hdr->num_hidden > 1) && + (mutt_thread_contains_unread(ctx, hdr) == 2); } /** diff --git a/help.c b/help.c index e6acadd9b7f..1628c216fb3 100644 --- a/help.c +++ b/help.c @@ -52,7 +52,7 @@ static const struct Binding *help_lookup_function(int op, int menu) /* first look in the generic map for the function */ for (int i = 0; OpGeneric[i].name; i++) if (OpGeneric[i].op == op) - return (&OpGeneric[i]); + return &OpGeneric[i]; } map = km_get_table(menu); @@ -60,7 +60,7 @@ static const struct Binding *help_lookup_function(int op, int menu) { for (int i = 0; map[i].name; i++) if (map[i].op == op) - return (&map[i]); + return &map[i]; } return NULL; @@ -161,7 +161,7 @@ static int print_macro(FILE *f, int maxwidth, const char **macro) fprintf(f, "?"); } } - return (maxwidth - n); + return maxwidth - n; } static int get_wrapped_width(const char *t, size_t wid) @@ -207,7 +207,7 @@ static int pad(FILE *f, int col, int i) return i; } fputc(' ', f); - return (col + 1); + return col + 1; } static void format_line(FILE *f, int ismacro, const char *t1, const char *t2, const char *t3) diff --git a/imap/command.c b/imap/command.c index e4e00927dae..32a30c562a7 100644 --- a/imap/command.c +++ b/imap/command.c @@ -1051,7 +1051,7 @@ int imap_cmd_step(struct ImapData *idata) */ bool imap_code(const char *s) { - return (cmd_status(s) == IMAP_CMD_OK); + return cmd_status(s) == IMAP_CMD_OK; } /** diff --git a/init.c b/init.c index 8b57f9f5480..a24d6ac0094 100644 --- a/init.c +++ b/init.c @@ -370,7 +370,7 @@ static size_t escape_string(char *buf, size_t buflen, const char *src) src++; } *p = '\0'; - return (p - buf); + return p - buf; } /** @@ -1353,7 +1353,7 @@ static int source_rc(const char *rcfile_path, struct Buffer *err) */ static int toggle_quadoption(int opt) { - return (opt ^= 1); + return opt ^= 1; } /** @@ -1363,8 +1363,9 @@ static int toggle_quadoption(int opt) */ static bool valid_show_multipart_alternative(const char *val) { - return ((mutt_str_strcmp(val, "inline") == 0) || - (mutt_str_strcmp(val, "info") == 0) || !val || (*val == 0)); + return (mutt_str_strcmp(val, "inline") == 0) || + (mutt_str_strcmp(val, "info") == 0) || + !val || (*val == 0); } /** @@ -4098,9 +4099,9 @@ int mutt_option_index(const char *s) { if (mutt_str_strcmp(s, MuttVars[i].name) == 0) { - return (MuttVars[i].type == DT_SYNONYM ? + return MuttVars[i].type == DT_SYNONYM ? mutt_option_index((char *) MuttVars[i].initial) : - i); + i; } } return -1; diff --git a/keymap.c b/keymap.c index 1c147e46d63..98997c31a58 100644 --- a/keymap.c +++ b/keymap.c @@ -258,7 +258,7 @@ static size_t parsekeys(const char *str, keycode_t *d, size_t max) len--; } - return (max - len); + return max - len; } /** @@ -541,7 +541,7 @@ static int retry_generic(int menu, keycode_t *keys, int keyslen, int lastkey) mutt_unget_event(lastkey, 0); for (; keyslen; keyslen--) mutt_unget_event(keys[keyslen - 1], 0); - return (km_dokey(MENU_GENERIC)); + return km_dokey(MENU_GENERIC); } if (menu != MENU_EDITOR) { @@ -567,7 +567,7 @@ int km_dokey(int menu) int n = 0; if (!map) - return (retry_generic(menu, NULL, 0, 0)); + return retry_generic(menu, NULL, 0, 0); while (true) { @@ -661,12 +661,12 @@ int km_dokey(int menu) while (LastKey > map->keys[pos]) { if (pos > map->eq || !map->next) - return (retry_generic(menu, map->keys, pos, LastKey)); + return retry_generic(menu, map->keys, pos, LastKey); map = map->next; } if (LastKey != map->keys[pos]) - return (retry_generic(menu, map->keys, pos, LastKey)); + return retry_generic(menu, map->keys, pos, LastKey); if (++pos == map->len) { diff --git a/maildir/mh.c b/maildir/mh.c index db12db8123c..16f7312bb9b 100644 --- a/maildir/mh.c +++ b/maildir/mh.c @@ -283,7 +283,7 @@ static inline mode_t mh_umask(struct Context *ctx) return 077; } - return (0777 & ~st.st_mode); + return 0777 & ~st.st_mode; } /** @@ -301,7 +301,7 @@ static int mh_sequences_changed(struct Buffy *b) if ((snprintf(path, sizeof(path), "%s/.mh_sequences", b->path) < sizeof(path)) && (stat(path, &sb) == 0)) { - return (sb.st_mtime > b->last_visited); + return sb.st_mtime > b->last_visited; } return -1; } @@ -322,7 +322,7 @@ static int mh_already_notified(struct Buffy *b, int msgno) if ((snprintf(path, sizeof(path), "%s/%d", b->path, msgno) < sizeof(path)) && (stat(path, &sb) == 0)) { - return (sb.st_mtime <= b->last_visited); + return sb.st_mtime <= b->last_visited; } return -1; } @@ -1099,7 +1099,7 @@ static size_t maildir_hcache_keylen(const char *fn) */ static int md_cmp_inode(struct Maildir *a, struct Maildir *b) { - return (a->inode - b->inode); + return a->inode - b->inode; } /** diff --git a/mbox/mbox.c b/mbox/mbox.c index 4e09d0e04e3..030ea0be993 100644 --- a/mbox/mbox.c +++ b/mbox/mbox.c @@ -785,7 +785,7 @@ static int reopen_mailbox(struct Context *ctx, int *index_hint) ctx->quiet = false; - return ((ctx->changed || msg_mod) ? MUTT_REOPENED : MUTT_NEW_MAIL); + return (ctx->changed || msg_mod) ? MUTT_REOPENED : MUTT_NEW_MAIL; } /** diff --git a/menu.c b/menu.c index adfb344bec0..ab305c5fc20 100644 --- a/menu.c +++ b/menu.c @@ -954,7 +954,7 @@ static int menu_search_generic(struct Menu *m, regex_t *re, int n) char buf[LONG_STRING]; menu_make_entry(buf, sizeof(buf), m, n); - return (regexec(re, buf, 0, NULL, 0)); + return regexec(re, buf, 0, NULL, 0); } /** diff --git a/mutt/base64.c b/mutt/base64.c index 8ae9a60397a..5ee67e32c6e 100644 --- a/mutt/base64.c +++ b/mutt/base64.c @@ -112,7 +112,7 @@ size_t mutt_b64_encode(char *out, const char *cin, size_t len, size_t olen) *out++ = '='; } *out = '\0'; - return (out - (char *) begin); + return out - (char *) begin; } /** diff --git a/mutt/buffer.c b/mutt/buffer.c index aca89616197..ce552542412 100644 --- a/mutt/buffer.c +++ b/mutt/buffer.c @@ -236,7 +236,7 @@ bool mutt_buffer_is_empty(const struct Buffer *buf) if (!buf) return true; - return (buf->data && (buf->data[0] == '\0')); + return buf->data && (buf->data[0] == '\0'); } /** diff --git a/mutt/charset.c b/mutt/charset.c index 34c8a996627..6bc71a43761 100644 --- a/mutt/charset.c +++ b/mutt/charset.c @@ -385,8 +385,8 @@ bool mutt_ch_chscmp(const char *cs1, const char *cs2) int len1 = mutt_str_strlen(buffer); int len2 = mutt_str_strlen(cs2); - return (mutt_str_strncasecmp((len1 > len2) ? buffer : cs2, - (len1 > len2) ? cs2 : buffer, MIN(len1, len2)) == 0); + return mutt_str_strncasecmp((len1 > len2 ? buffer : cs2), + (len1 > len2 ? cs2 : buffer), MIN(len1, len2)) == 0; } /** diff --git a/mutt/date.c b/mutt/date.c index 002f5200e67..1562bc3e2f8 100644 --- a/mutt/date.c +++ b/mutt/date.c @@ -165,7 +165,7 @@ static int is_leap_year_feb(struct tm *tm) return 0; int y = tm->tm_year + 1900; - return (((y & 3) == 0) && (((y % 100) != 0) || ((y % 400) == 0))); + return ((y & 3) == 0) && (((y % 100) != 0) || ((y % 400) == 0)); } /** @@ -222,7 +222,7 @@ time_t mutt_date_local_tz(time_t t) /* need to make a copy because gmtime/localtime return a pointer to static memory (grr!) */ memcpy(&utc, ptm, sizeof(utc)); - return (compute_tz(t, &utc)); + return compute_tz(t, &utc); } /** @@ -681,7 +681,7 @@ time_t mutt_date_parse_imap(char *s) if (s[0] == '+') tz = -tz; - return (mutt_date_make_time(&t, 0) + tz); + return mutt_date_make_time(&t, 0) + tz; } /** @@ -700,5 +700,5 @@ time_t mutt_date_add_timeout(time_t now, long timeout) if ((TIME_T_MAX - now) < timeout) return TIME_T_MAX; - return (now + timeout); + return now + timeout; } diff --git a/mutt/file.c b/mutt/file.c index da150fa4cf0..c8f307b7ef4 100644 --- a/mutt/file.c +++ b/mutt/file.c @@ -73,8 +73,9 @@ static const char safe_chars[] = */ static bool compare_stat(struct stat *osb, struct stat *nsb) { - return ((osb->st_dev == nsb->st_dev) && (osb->st_ino == nsb->st_ino) && - (osb->st_rdev == nsb->st_rdev)); + return (osb->st_dev == nsb->st_dev ) && + (osb->st_ino == nsb->st_ino ) && + (osb->st_rdev == nsb->st_rdev); } /** @@ -534,10 +535,10 @@ FILE *mutt_file_fopen(const char *path, const char *mode) if (fd < 0) return NULL; - return (fdopen(fd, mode)); + return fdopen(fd, mode); } else - return (fopen(path, mode)); + return fopen(path, mode); } /** @@ -787,7 +788,7 @@ const char *mutt_file_basename(const char *f) { const char *p = strrchr(f, '/'); if (p) - return (p + 1); + return p + 1; else return f; } @@ -1385,5 +1386,5 @@ int mutt_file_check_empty(const char *path) if (stat(path, &st) == -1) return -1; - return ((st.st_size == 0)); + return st.st_size == 0; } diff --git a/mutt/hash.c b/mutt/hash.c index 4179df3f959..e493c7e8904 100644 --- a/mutt/hash.c +++ b/mutt/hash.c @@ -107,7 +107,7 @@ static int cmp_case_string_key(union HashKey a, union HashKey b) */ static size_t gen_int_hash(union HashKey key, size_t n) { - return (key.intkey % n); + return key.intkey % n; } /** diff --git a/mutt/history.c b/mutt/history.c index 04728be70d3..b9a72158f16 100644 --- a/mutt/history.c +++ b/mutt/history.c @@ -637,7 +637,7 @@ bool mutt_hist_at_scratch(enum HistoryClass hclass) if (!History || !h) return false; /* disabled */ - return (h->cur == h->last); + return h->cur == h->last; } /** diff --git a/mutt/logging.c b/mutt/logging.c index 600365729f5..450c8941413 100644 --- a/mutt/logging.c +++ b/mutt/logging.c @@ -214,7 +214,7 @@ void log_file_set_version(const char *version) */ bool log_file_running(void) { - return (LogFileFP != NULL); + return LogFileFP != NULL; } /** diff --git a/mutt/mbyte.c b/mutt/mbyte.c index 174e93841b2..48ab891e0a0 100644 --- a/mutt/mbyte.c +++ b/mutt/mbyte.c @@ -218,7 +218,7 @@ size_t mutt_mb_width_ceiling(const wchar_t *s, size_t n, int w1) for (; n; s++, n--) if ((w += mutt_mb_wcwidth(*s)) > w1) break; - return (s - s0); + return s - s0; } /** @@ -332,7 +332,7 @@ size_t mutt_mb_mbstowcs(wchar_t **pwbuf, size_t *pwbuflen, size_t i, char *buf) bool mutt_mb_is_shell_char(wchar_t ch) { static const wchar_t shell_chars[] = L"<>&()$?*;{}| "; /* ! not included because it can be part of a pathname in NeoMutt */ - return (wcschr(shell_chars, ch) != NULL); + return wcschr(shell_chars, ch) != NULL; } /** diff --git a/mutt/string.c b/mutt/string.c index 09c1c0322c3..1c09e9e0c1d 100644 --- a/mutt/string.c +++ b/mutt/string.c @@ -656,7 +656,7 @@ size_t mutt_str_strfcpy(char *dest, const char *src, size_t dsize) *dest++ = *src++; *dest = '\0'; - return (dest - dest0); + return dest - dest0; } /** diff --git a/mutt_account.c b/mutt_account.c index 9b0ac6583b7..4fda2f797a3 100644 --- a/mutt_account.c +++ b/mutt_account.c @@ -83,15 +83,15 @@ int mutt_account_match(const struct Account *a1, const struct Account *a2) #endif if (a1->flags & a2->flags & MUTT_ACCT_USER) - return (strcmp(a1->user, a2->user) == 0); + return strcmp(a1->user, a2->user) == 0; #ifdef USE_NNTP if (a1->type == MUTT_ACCT_TYPE_NNTP) return a1->flags & MUTT_ACCT_USER && a1->user[0] ? 0 : 1; #endif if (a1->flags & MUTT_ACCT_USER) - return (strcmp(a1->user, user) == 0); + return strcmp(a1->user, user) == 0; if (a2->flags & MUTT_ACCT_USER) - return (strcmp(a2->user, user) == 0); + return strcmp(a2->user, user) == 0; return 1; } diff --git a/mutt_attach.c b/mutt_attach.c index 60d540ec749..4f976b8a054 100644 --- a/mutt_attach.c +++ b/mutt_attach.c @@ -1093,7 +1093,7 @@ int mutt_print_attachment(FILE *fp, struct Body *a) if ((mutt_str_strcasecmp("text/plain", type) == 0) || (mutt_str_strcasecmp("application/postscript", type) == 0)) { - return (mutt_pipe_attachment(fp, a, NONULL(PrintCommand), NULL)); + return mutt_pipe_attachment(fp, a, NONULL(PrintCommand), NULL); } else if (mutt_can_decode(a)) { diff --git a/mutt_logging.c b/mutt_logging.c index 21f52f46480..39977e570fc 100644 --- a/mutt_logging.c +++ b/mutt_logging.c @@ -66,7 +66,7 @@ static long micro_elapsed(const struct timeval *begin, const struct timeval *end if ((begin->tv_sec == 0) && (end->tv_sec != 0)) return LONG_MAX; - return ((end->tv_sec - begin->tv_sec) * S_TO_US) + (end->tv_usec - begin->tv_usec); + return (end->tv_sec - begin->tv_sec) * S_TO_US + (end->tv_usec - begin->tv_usec); } /** diff --git a/mutt_thread.c b/mutt_thread.c index 1a72b79c6f0..22b096967f4 100644 --- a/mutt_thread.c +++ b/mutt_thread.c @@ -49,7 +49,7 @@ bool ThreadReceived; static bool is_visible(struct Header *hdr, struct Context *ctx) { - return (hdr->virtual >= 0 || (hdr->collapsed && (!ctx->pattern || hdr->limited))); + return hdr->virtual >= 0 || (hdr->collapsed && (!ctx->pattern || hdr->limited)); } /** @@ -583,7 +583,7 @@ static int compare_threads(const void *a, const void *b) else { sort_func = mutt_get_sort_func(Sort); - return (sort_func ? 1 : 0); + return sort_func ? 1 : 0; } } @@ -1171,7 +1171,7 @@ int mutt_traverse_thread(struct Context *ctx, struct Header *cur, int flag) if (flag & (MUTT_THREAD_COLLAPSE | MUTT_THREAD_UNCOLLAPSE)) return final; else if (flag & MUTT_THREAD_UNREAD) - return ((old && new) ? new : (old ? old : new)); + return (old && new) ? new : (old ? old : new); else if (flag & MUTT_THREAD_GET_HIDDEN) return num_hidden; else if (flag & MUTT_THREAD_NEXT_UNREAD) @@ -1261,9 +1261,9 @@ int mutt_traverse_thread(struct Context *ctx, struct Header *cur, int flag) if (flag & (MUTT_THREAD_COLLAPSE | MUTT_THREAD_UNCOLLAPSE)) return final; else if (flag & MUTT_THREAD_UNREAD) - return ((old && new) ? new : (old ? old : new)); + return (old && new) ? new : (old ? old : new); else if (flag & MUTT_THREAD_GET_HIDDEN) - return (num_hidden + 1); + return num_hidden + 1; else if (flag & MUTT_THREAD_NEXT_UNREAD) return min_unread; else if (flag & MUTT_THREAD_FLAGGED) diff --git a/muttlib.c b/muttlib.c index 28e832c155d..4e477306881 100644 --- a/muttlib.c +++ b/muttlib.c @@ -1557,7 +1557,9 @@ int mutt_inbox_cmp(const char *a, const char *b) { return (mutt_str_strcasecmp(a + 1, "inbox") == 0) ? -1 : - (mutt_str_strcasecmp(b + 1, "inbox") == 0) ? 1 : 0; + (mutt_str_strcasecmp(b + 1, "inbox") == 0) ? + 1 : + 0; } const char *a_end = strrchr(a, '/'); diff --git a/mx.c b/mx.c index 8178d07505c..d612bc68f24 100644 --- a/mx.c +++ b/mx.c @@ -139,7 +139,7 @@ struct MxOps *mx_get_ops(int magic) */ static bool mutt_is_spool(const char *str) { - return (mutt_str_strcmp(Spoolfile, str) == 0); + return mutt_str_strcmp(Spoolfile, str) == 0; } #ifdef USE_IMAP diff --git a/ncrypt/crypt.c b/ncrypt/crypt.c index 46d5e0c9eaa..e5eb938581a 100644 --- a/ncrypt/crypt.c +++ b/ncrypt/crypt.c @@ -542,7 +542,7 @@ int mutt_is_application_smime(struct Body *m) if (mutt_str_strcasecmp(t, "enveloped-data") == 0) return SMIMEENCRYPT; else if (mutt_str_strcasecmp(t, "signed-data") == 0) - return (SMIMESIGN | SMIMEOPAQUE); + return SMIMESIGN | SMIMEOPAQUE; else return 0; } @@ -583,10 +583,10 @@ int mutt_is_application_smime(struct Body *m) { /* Not sure if this is the correct thing to do, but it's required for compatibility with Outlook */ - return (SMIMESIGN | SMIMEOPAQUE); + return SMIMESIGN | SMIMEOPAQUE; } else if (mutt_str_strcasecmp((t + len), "p7s") == 0) - return (SMIMESIGN | SMIMEOPAQUE); + return SMIMESIGN | SMIMEOPAQUE; } return 0; diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index 30794741fec..3cf276c32e9 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -135,7 +135,7 @@ static char *current_sender = NULL; static bool is_pka_notation(gpgme_sig_notation_t notation) { - return (mutt_str_strcmp(notation->name, PKA_NOTATION_NAME) == 0); + return mutt_str_strcmp(notation->name, PKA_NOTATION_NAME) == 0; } /** @@ -165,7 +165,7 @@ static void redraw_if_needed(gpgme_ctx_t ctx) */ static int digit_or_letter(const unsigned char *s) { - return ((*s >= '0' && *s < '9') || (*s >= 'A' && *s <= 'Z') || (*s >= 'a' && *s <= 'z')); + return (*s >= '0' && *s < '9') || (*s >= 'A' && *s <= 'Z') || (*s >= 'a' && *s <= 'z'); } /** @@ -3156,9 +3156,9 @@ static int compare_key_address(const void *a, const void *b) r = mutt_str_strcasecmp((*s)->uid, (*t)->uid); if (r != 0) - return (r > 0); + return r > 0; else - return (mutt_str_strcasecmp(crypt_fpr_or_lkeyid(*s), crypt_fpr_or_lkeyid(*t)) > 0); + return mutt_str_strcasecmp(crypt_fpr_or_lkeyid(*s), crypt_fpr_or_lkeyid(*t)) > 0; } static int crypt_compare_address(const void *a, const void *b) @@ -3183,14 +3183,14 @@ static int compare_keyid(const void *a, const void *b) r = mutt_str_strcasecmp(crypt_fpr_or_lkeyid(*s), crypt_fpr_or_lkeyid(*t)); if (r != 0) - return (r > 0); + return r > 0; else - return (mutt_str_strcasecmp((*s)->uid, (*t)->uid) > 0); + return mutt_str_strcasecmp((*s)->uid, (*t)->uid) > 0; } static int crypt_compare_keyid(const void *a, const void *b) { - return ((PgpSortKeys & SORT_REVERSE) ? !compare_keyid(a, b) : compare_keyid(a, b)); + return (PgpSortKeys & SORT_REVERSE) ? !compare_keyid(a, b) : compare_keyid(a, b); } /** @@ -3217,12 +3217,12 @@ static int compare_key_date(const void *a, const void *b) if (ts < tt) return 0; - return (mutt_str_strcasecmp((*s)->uid, (*t)->uid) > 0); + return mutt_str_strcasecmp((*s)->uid, (*t)->uid) > 0; } static int crypt_compare_date(const void *a, const void *b) { - return ((PgpSortKeys & SORT_REVERSE) ? !compare_key_date(a, b) : compare_key_date(a, b)); + return (PgpSortKeys & SORT_REVERSE) ? !compare_key_date(a, b) : compare_key_date(a, b); } /** @@ -3245,20 +3245,20 @@ static int compare_key_trust(const void *a, const void *b) r = (((*s)->flags & (KEYFLAG_RESTRICTIONS)) - ((*t)->flags & (KEYFLAG_RESTRICTIONS))); if (r != 0) - return (r > 0); + return r > 0; ts = (*s)->validity; tt = (*t)->validity; r = (tt - ts); if (r != 0) - return (r < 0); + return r < 0; if ((*s)->kobj->subkeys) ts = (*s)->kobj->subkeys->length; if ((*t)->kobj->subkeys) tt = (*t)->kobj->subkeys->length; if (ts != tt) - return (ts > tt); + return ts > tt; if ((*s)->kobj->subkeys && ((*s)->kobj->subkeys->timestamp > 0)) ts = (*s)->kobj->subkeys->timestamp; @@ -3271,8 +3271,8 @@ static int compare_key_trust(const void *a, const void *b) r = mutt_str_strcasecmp((*s)->uid, (*t)->uid); if (r != 0) - return (r > 0); - return (mutt_str_strcasecmp(crypt_fpr_or_lkeyid((*s)), crypt_fpr_or_lkeyid((*t))) > 0); + return r > 0; + return mutt_str_strcasecmp(crypt_fpr_or_lkeyid((*s)), crypt_fpr_or_lkeyid((*t))) > 0; } static int crypt_compare_trust(const void *a, const void *b) diff --git a/ncrypt/pgp.c b/ncrypt/pgp.c index 375beeb977f..dabd3ce3c92 100644 --- a/ncrypt/pgp.c +++ b/ncrypt/pgp.c @@ -152,7 +152,7 @@ char *pgp_short_keyid(struct PgpKeyInfo *k) { k = key_parent(k); - return (k->keyid + 8); + return k->keyid + 8; } char *pgp_this_keyid(struct PgpKeyInfo *k) @@ -160,7 +160,7 @@ char *pgp_this_keyid(struct PgpKeyInfo *k) if (PgpLongIds) return k->keyid; else - return (k->keyid + 8); + return k->keyid + 8; } char *pgp_keyid(struct PgpKeyInfo *k) diff --git a/ncrypt/pgpkey.c b/ncrypt/pgpkey.c index 43725cfba2a..73209839eb9 100644 --- a/ncrypt/pgpkey.c +++ b/ncrypt/pgpkey.c @@ -348,18 +348,18 @@ static int compare_key_address(const void *a, const void *b) r = mutt_str_strcasecmp((*s)->addr, (*t)->addr); if (r != 0) - return (r > 0); + return r > 0; else { - return (mutt_str_strcasecmp(pgp_fpr_or_lkeyid((*s)->parent), - pgp_fpr_or_lkeyid((*t)->parent)) > 0); + return mutt_str_strcasecmp(pgp_fpr_or_lkeyid((*s)->parent), + pgp_fpr_or_lkeyid((*t)->parent)) > 0; } } static int pgp_compare_address(const void *a, const void *b) { - return ((PgpSortKeys & SORT_REVERSE) ? !compare_key_address(a, b) : - compare_key_address(a, b)); + return (PgpSortKeys & SORT_REVERSE) ? !compare_key_address(a, b) : + compare_key_address(a, b); } static int compare_keyid(const void *a, const void *b) @@ -371,14 +371,14 @@ static int compare_keyid(const void *a, const void *b) r = mutt_str_strcasecmp(pgp_fpr_or_lkeyid((*s)->parent), pgp_fpr_or_lkeyid((*t)->parent)); if (r != 0) - return (r > 0); + return r > 0; else - return (mutt_str_strcasecmp((*s)->addr, (*t)->addr) > 0); + return mutt_str_strcasecmp((*s)->addr, (*t)->addr) > 0; } static int pgp_compare_keyid(const void *a, const void *b) { - return ((PgpSortKeys & SORT_REVERSE) ? !compare_keyid(a, b) : compare_keyid(a, b)); + return (PgpSortKeys & SORT_REVERSE) ? !compare_keyid(a, b) : compare_keyid(a, b); } static int compare_key_date(const void *a, const void *b) @@ -389,13 +389,13 @@ static int compare_key_date(const void *a, const void *b) r = ((*s)->parent->gen_time - (*t)->parent->gen_time); if (r != 0) - return (r > 0); - return (mutt_str_strcasecmp((*s)->addr, (*t)->addr) > 0); + return r > 0; + return mutt_str_strcasecmp((*s)->addr, (*t)->addr) > 0; } static int pgp_compare_date(const void *a, const void *b) { - return ((PgpSortKeys & SORT_REVERSE) ? !compare_key_date(a, b) : compare_key_date(a, b)); + return (PgpSortKeys & SORT_REVERSE) ? !compare_key_date(a, b) : compare_key_date(a, b); } static int compare_key_trust(const void *a, const void *b) @@ -408,27 +408,27 @@ static int compare_key_trust(const void *a, const void *b) r = (((*s)->parent->flags & (KEYFLAG_RESTRICTIONS)) - ((*t)->parent->flags & (KEYFLAG_RESTRICTIONS))); if (r != 0) - return (r > 0); + return r > 0; r = ((*s)->trust - (*t)->trust); if (r != 0) - return (r < 0); + return r < 0; r = ((*s)->parent->keylen - (*t)->parent->keylen); if (r != 0) - return (r < 0); + return r < 0; r = ((*s)->parent->gen_time - (*t)->parent->gen_time); if (r != 0) - return (r < 0); + return r < 0; r = mutt_str_strcasecmp((*s)->addr, (*t)->addr); if (r != 0) - return (r > 0); - return (mutt_str_strcasecmp(pgp_fpr_or_lkeyid((*s)->parent), - pgp_fpr_or_lkeyid((*t)->parent)) > 0); + return r > 0; + return mutt_str_strcasecmp(pgp_fpr_or_lkeyid((*s)->parent), + pgp_fpr_or_lkeyid((*t)->parent)) > 0; } static int pgp_compare_trust(const void *a, const void *b) { - return ((PgpSortKeys & SORT_REVERSE) ? !compare_key_trust(a, b) : - compare_key_trust(a, b)); + return (PgpSortKeys & SORT_REVERSE) ? !compare_key_trust(a, b) : + compare_key_trust(a, b); } static bool pgp_key_is_valid(struct PgpKeyInfo *k) diff --git a/pager.c b/pager.c index c7ba57057bf..2fc136a8315 100644 --- a/pager.c +++ b/pager.c @@ -1057,7 +1057,7 @@ static int is_ansi(unsigned char *buf) { while (*buf && (isdigit(*buf) || *buf == ';')) buf++; - return (*buf == 'm'); + return *buf == 'm'; } static int grok_ansi(unsigned char *buf, int pos, struct AnsiAttr *a) @@ -3372,5 +3372,5 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e FREE(&rd.pager_status_window); FREE(&rd.pager_window); - return (rc != -1 ? rc : 0); + return rc != -1 ? rc : 0; } diff --git a/pattern.c b/pattern.c index a9c044a3f95..91f50a2e519 100644 --- a/pattern.c +++ b/pattern.c @@ -273,7 +273,7 @@ static const char *get_offset(struct tm *tm, const char *s, int sign) return s; } mutt_date_normalize_time(tm); - return (ps + 1); + return ps + 1; } /** @@ -420,7 +420,7 @@ static const char *parse_date_range(const char *pc, struct tm *min, struct tm *m { /* get_date has its own error message, don't overwrite it here */ mutt_buffer_printf(err, _("Invalid relative date: %s"), pc - 1); } - return ((flag & MUTT_PDR_ERROR) ? NULL : pc); + return (flag & MUTT_PDR_ERROR) ? NULL : pc; } /** @@ -769,9 +769,9 @@ static int scan_range_num(struct Buffer *s, regmatch_t pmatch[], int group, int case RANGE_K_REL: return num + CTX_MSGNO(Context); case RANGE_K_LT: - return (num - 1); + return num - 1; case RANGE_K_GT: - return (num + 1); + return num + 1; default: return num; } @@ -1179,7 +1179,7 @@ static const struct PatternFlags *lookup_tag(char tag) { for (int i = 0; Flags[i].tag; i++) if (Flags[i].tag == tag) - return (&Flags[i]); + return &Flags[i]; return NULL; } @@ -1544,7 +1544,7 @@ static int match_addrlist(struct Pattern *pat, bool match_personal, int n, ...) (match_personal && a->personal && !patmatch(pat, a->personal))))) { va_end(ap); - return (!pat->alladdr); /* Found match, or non-match if alladdr */ + return !pat->alladdr; /* Found match, or non-match if alladdr */ } } } @@ -1581,10 +1581,10 @@ int mutt_is_list_recipient(bool alladdr, struct Address *a1, struct Address *a2) { for (; a1; a1 = a1->next) if (alladdr ^ mutt_is_subscribed_list(a1)) - return (!alladdr); + return !alladdr; for (; a2; a2 = a2->next) if (alladdr ^ mutt_is_subscribed_list(a2)) - return (!alladdr); + return !alladdr; return alladdr; } @@ -1603,10 +1603,10 @@ int mutt_is_list_cc(int alladdr, struct Address *a1, struct Address *a2) { for (; a1; a1 = a1->next) if (alladdr ^ mutt_is_mail_list(a1)) - return (!alladdr); + return !alladdr; for (; a2; a2 = a2->next) if (alladdr ^ mutt_is_mail_list(a2)) - return (!alladdr); + return !alladdr; return alladdr; } @@ -1622,10 +1622,10 @@ static int match_user(int alladdr, struct Address *a1, struct Address *a2) { for (; a1; a1 = a1->next) if (alladdr ^ mutt_addr_is_user(a1)) - return (!alladdr); + return !alladdr; for (; a2; a2 = a2->next) if (alladdr ^ mutt_addr_is_user(a2)) - return (!alladdr); + return !alladdr; return alladdr; } @@ -1774,7 +1774,7 @@ static void set_pattern_cache_value(int *cache_entry, int value) */ static int get_pattern_cache_value(int cache_entry) { - return (cache_entry == 2); + return cache_entry == 2; } /** @@ -1784,7 +1784,7 @@ static int get_pattern_cache_value(int cache_entry) */ static int is_pattern_cache_set(int cache_entry) { - return (cache_entry != 0); + return cache_entry != 0; } /** @@ -1811,44 +1811,44 @@ int mutt_pattern_exec(struct Pattern *pat, enum PatternExecFlag flags, switch (pat->op) { case MUTT_AND: - return (pat->not ^ (perform_and(pat->child, flags, ctx, h, cache) > 0)); + return pat->not ^ (perform_and(pat->child, flags, ctx, h, cache) > 0); case MUTT_OR: - return (pat->not ^ (perform_or(pat->child, flags, ctx, h, cache) > 0)); + return pat->not ^ (perform_or(pat->child, flags, ctx, h, cache) > 0); case MUTT_THREAD: - return (pat->not ^ - match_threadcomplete(pat->child, flags, ctx, h->thread, 1, 1, 1, 1)); + return pat->not ^ + match_threadcomplete(pat->child, flags, ctx, h->thread, 1, 1, 1, 1); case MUTT_PARENT: - return (pat->not ^ match_threadparent(pat->child, flags, ctx, h->thread)); + return pat->not ^ match_threadparent(pat->child, flags, ctx, h->thread); case MUTT_CHILDREN: - return (pat->not ^ match_threadchildren(pat->child, flags, ctx, h->thread)); + return pat->not ^ match_threadchildren(pat->child, flags, ctx, h->thread); case MUTT_ALL: return !pat->not; case MUTT_EXPIRED: - return (pat->not ^ h->expired); + return pat->not ^ h->expired; case MUTT_SUPERSEDED: - return (pat->not ^ h->superseded); + return pat->not ^ h->superseded; case MUTT_FLAG: - return (pat->not ^ h->flagged); + return pat->not ^ h->flagged; case MUTT_TAG: - return (pat->not ^ h->tagged); + return pat->not ^ h->tagged; case MUTT_NEW: - return (pat->not? h->old || h->read : !(h->old || h->read)); + return pat->not? h->old || h->read : !(h->old || h->read); case MUTT_UNREAD: - return (pat->not? h->read : !h->read); + return pat->not? h->read : !h->read; case MUTT_REPLIED: - return (pat->not ^ h->replied); + return pat->not ^ h->replied; case MUTT_OLD: - return (pat->not? (!h->old || h->read) : (h->old && !h->read)); + return pat->not? (!h->old || h->read) : (h->old && !h->read); case MUTT_READ: - return (pat->not ^ h->read); + return pat->not ^ h->read; case MUTT_DELETED: - return (pat->not ^ h->deleted); + return pat->not ^ h->deleted; case MUTT_MESSAGE: - return (pat->not ^ ((HMSG(h) >= pat->min) && (HMSG(h) <= pat->max))); + return pat->not ^ ((HMSG(h) >= pat->min) && (HMSG(h) <= pat->max)); case MUTT_DATE: - return (pat->not ^ (h->date_sent >= pat->min && h->date_sent <= pat->max)); + return pat->not ^ (h->date_sent >= pat->min && h->date_sent <= pat->max); case MUTT_DATE_RECEIVED: - return (pat->not ^ (h->received >= pat->min && h->received <= pat->max)); + return pat->not ^ (h->received >= pat->min && h->received <= pat->max); case MUTT_BODY: case MUTT_HEADER: case MUTT_WHOLE_MSG: @@ -1864,7 +1864,7 @@ int mutt_pattern_exec(struct Pattern *pat, enum PatternExecFlag flags, if (ctx->magic == MUTT_IMAP && pat->stringmatch) return h->matched; #endif - return (pat->not ^ msg_search(ctx, pat, h->msgno)); + return pat->not ^ msg_search(ctx, pat, h->msgno); case MUTT_SERVERSEARCH: #ifdef USE_IMAP if (!ctx) @@ -1872,7 +1872,7 @@ int mutt_pattern_exec(struct Pattern *pat, enum PatternExecFlag flags, if (ctx->magic == MUTT_IMAP) { if (pat->stringmatch) - return (h->matched); + return h->matched; return 0; } mutt_error(_("error: server custom search only supported with IMAP.")); @@ -1884,53 +1884,53 @@ int mutt_pattern_exec(struct Pattern *pat, enum PatternExecFlag flags, case MUTT_SENDER: if (!h->env) return 0; - return (pat->not ^ match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), - 1, h->env->sender)); + return pat->not ^ match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), + 1, h->env->sender); case MUTT_FROM: if (!h->env) return 0; - return (pat->not ^ match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), - 1, h->env->from)); + return pat->not ^ + match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 1, h->env->from); case MUTT_TO: if (!h->env) return 0; - return (pat->not ^ - match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 1, h->env->to)); + return pat->not ^ + match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 1, h->env->to); case MUTT_CC: if (!h->env) return 0; - return (pat->not ^ - match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 1, h->env->cc)); + return pat->not ^ + match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 1, h->env->cc); case MUTT_SUBJECT: if (!h->env) return 0; - return (pat->not ^ (h->env->subject && patmatch(pat, h->env->subject) == 0)); + return pat->not ^ (h->env->subject && patmatch(pat, h->env->subject) == 0); case MUTT_ID: if (!h->env) return 0; - return (pat->not ^ (h->env->message_id && patmatch(pat, h->env->message_id) == 0)); + return pat->not ^ (h->env->message_id && patmatch(pat, h->env->message_id) == 0); case MUTT_SCORE: - return (pat->not ^ (h->score >= pat->min && - (pat->max == MUTT_MAXRANGE || h->score <= pat->max))); + return pat->not ^ (h->score >= pat->min && + (pat->max == MUTT_MAXRANGE || h->score <= pat->max)); case MUTT_SIZE: - return (pat->not ^ (h->content->length >= pat->min && - (pat->max == MUTT_MAXRANGE || h->content->length <= pat->max))); + return pat->not ^ (h->content->length >= pat->min && + (pat->max == MUTT_MAXRANGE || h->content->length <= pat->max)); case MUTT_REFERENCE: if (!h->env) return 0; - return (pat->not ^ (match_reference(pat, &h->env->references) || - match_reference(pat, &h->env->in_reply_to))); + return pat->not ^ (match_reference(pat, &h->env->references) || + match_reference(pat, &h->env->in_reply_to)); case MUTT_ADDRESS: if (!h->env) return 0; - return (pat->not ^ match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), - 4, h->env->from, h->env->sender, - h->env->to, h->env->cc)); + return pat->not ^ match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), + 4, h->env->from, h->env->sender, + h->env->to, h->env->cc); case MUTT_RECIPIENT: if (!h->env) return 0; - return (pat->not ^ match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), - 2, h->env->to, h->env->cc)); + return pat->not ^ match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), + 2, h->env->to, h->env->cc); case MUTT_LIST: /* known list, subscribed or not */ if (!h->env) return 0; @@ -1946,7 +1946,7 @@ int mutt_pattern_exec(struct Pattern *pat, enum PatternExecFlag flags, } else result = mutt_is_list_cc(pat->alladdr, h->env->to, h->env->cc); - return (pat->not ^ result); + return pat->not ^ result; case MUTT_SUBSCRIBED_LIST: if (!h->env) return 0; @@ -1963,7 +1963,7 @@ int mutt_pattern_exec(struct Pattern *pat, enum PatternExecFlag flags, } else result = mutt_is_list_recipient(pat->alladdr, h->env->to, h->env->cc); - return (pat->not ^ result); + return pat->not ^ result; case MUTT_PERSONAL_RECIP: if (!h->env) return 0; @@ -1979,7 +1979,7 @@ int mutt_pattern_exec(struct Pattern *pat, enum PatternExecFlag flags, } else result = match_user(pat->alladdr, h->env->to, h->env->cc); - return (pat->not ^ result); + return pat->not ^ result; case MUTT_PERSONAL_FROM: if (!h->env) return 0; @@ -1992,29 +1992,29 @@ int mutt_pattern_exec(struct Pattern *pat, enum PatternExecFlag flags, } else result = match_user(pat->alladdr, h->env->from, NULL); - return (pat->not ^ result); + return pat->not ^ result; case MUTT_COLLAPSED: - return (pat->not ^ (h->collapsed && h->num_hidden > 1)); + return pat->not ^ (h->collapsed && h->num_hidden > 1); case MUTT_CRYPT_SIGN: if (!WithCrypto) break; - return (pat->not ^ ((h->security & SIGN) ? 1 : 0)); + return pat->not ^ ((h->security & SIGN) ? 1 : 0); case MUTT_CRYPT_VERIFIED: if (!WithCrypto) break; - return (pat->not ^ ((h->security & GOODSIGN) ? 1 : 0)); + return pat->not ^ ((h->security & GOODSIGN) ? 1 : 0); case MUTT_CRYPT_ENCRYPT: if (!WithCrypto) break; - return (pat->not ^ ((h->security & ENCRYPT) ? 1 : 0)); + return pat->not ^ ((h->security & ENCRYPT) ? 1 : 0); case MUTT_PGP_KEY: if (!(WithCrypto & APPLICATION_PGP)) break; - return (pat->not ^ ((h->security & PGPKEY) == PGPKEY)); + return pat->not ^ ((h->security & PGPKEY) == PGPKEY); case MUTT_XLABEL: if (!h->env) return 0; - return (pat->not ^ (h->env->x_label && patmatch(pat, h->env->x_label) == 0)); + return pat->not ^ (h->env->x_label && patmatch(pat, h->env->x_label) == 0); case MUTT_DRIVER_TAGS: { char *tags = driver_tags_get(&h->tags); @@ -2025,31 +2025,31 @@ int mutt_pattern_exec(struct Pattern *pat, enum PatternExecFlag flags, case MUTT_HORMEL: if (!h->env) return 0; - return (pat->not ^ (h->env->spam && h->env->spam->data && - patmatch(pat, h->env->spam->data) == 0)); + return pat->not ^ (h->env->spam && h->env->spam->data && + patmatch(pat, h->env->spam->data) == 0); case MUTT_DUPLICATED: - return (pat->not ^ (h->thread && h->thread->duplicate_thread)); + return pat->not ^ (h->thread && h->thread->duplicate_thread); case MUTT_MIMEATTACH: if (!ctx) return 0; { int count = mutt_count_body_parts(ctx, h); - return (pat->not ^ (count >= pat->min && - (pat->max == MUTT_MAXRANGE || count <= pat->max))); + return pat->not ^ (count >= pat->min && + (pat->max == MUTT_MAXRANGE || count <= pat->max)); } case MUTT_MIMETYPE: if (!ctx) return 0; - return (pat->not ^ match_mime_content_type(pat, ctx, h)); + return pat->not ^ match_mime_content_type(pat, ctx, h); case MUTT_UNREFERENCED: - return (pat->not ^ (h->thread && !h->thread->child)); + return pat->not ^ (h->thread && !h->thread->child); case MUTT_BROKEN: - return (pat->not ^ (h->thread && h->thread->fake_thread)); + return pat->not ^ (h->thread && h->thread->fake_thread); #ifdef USE_NNTP case MUTT_NEWSGROUPS: if (!h->env) return 0; - return (pat->not ^ (h->env->newsgroups && patmatch(pat, h->env->newsgroups) == 0)); + return pat->not ^ (h->env->newsgroups && patmatch(pat, h->env->newsgroups) == 0); #endif } mutt_error(_("error: unknown op %d (report this error)."), pat->op); diff --git a/pop/pop.c b/pop/pop.c index ad9d4822df2..d5ed1c674ff 100644 --- a/pop/pop.c +++ b/pop/pop.c @@ -479,7 +479,7 @@ static int pop_fetch_headers(struct Context *ctx) mutt_bcache_list(pop_data->bcache, msg_cache_check, (void *) ctx); mutt_clear_error(); - return (new_count - old_count); + return new_count - old_count; } /** diff --git a/postpone.c b/postpone.c index a6fd8dd6cd4..8b87ffc3951 100644 --- a/postpone.c +++ b/postpone.c @@ -157,7 +157,7 @@ int mutt_num_postponed(int force) LastModify = st.st_mtime; if (access(Postponed, R_OK | F_OK) != 0) - return (PostCount = 0); + return PostCount = 0; #ifdef USE_NNTP if (optnews) OptNews = false; @@ -264,7 +264,7 @@ static struct Header *select_msg(void) Sort = orig_sort; mutt_menu_pop_current(menu); mutt_menu_destroy(&menu); - return (r > -1 ? PostContext->hdrs[r] : NULL); + return r > -1 ? PostContext->hdrs[r] : NULL; } /** diff --git a/query.c b/query.c index 6d1007d52d3..461349ca311 100644 --- a/query.c +++ b/query.c @@ -307,7 +307,7 @@ static int query_tag(struct Menu *menu, int n, int m) bool ot = cur->tagged; cur->tagged = m >= 0 ? m : !cur->tagged; - return (cur->tagged - ot); + return cur->tagged - ot; } static void query_menu(char *buf, size_t buflen, struct Query *results, int retbuf) diff --git a/recvattach.c b/recvattach.c index ed5abe29f97..8430ef3d499 100644 --- a/recvattach.c +++ b/recvattach.c @@ -457,7 +457,7 @@ int mutt_tag_attach(struct Menu *menu, int n, int m) bool ot = cur->tagged; cur->tagged = (m >= 0 ? m : !cur->tagged); - return (cur->tagged - ot); + return cur->tagged - ot; } /** diff --git a/rfc3676.c b/rfc3676.c index 7660e727250..318d9bc97c4 100644 --- a/rfc3676.c +++ b/rfc3676.c @@ -146,7 +146,7 @@ static size_t print_indent(int ql, struct State *s, int add_suffix) if (space_quotes(s)) ql *= 2; - return (ql + add_suffix + wid); + return ql + add_suffix + wid; } static void flush_par(struct State *s, struct FlowedState *fst) diff --git a/sendlib.c b/sendlib.c index 13abedbaa3e..225ffd12624 100644 --- a/sendlib.c +++ b/sendlib.c @@ -458,7 +458,7 @@ int mutt_write_mime_header(struct Body *a, FILE *f) fprintf(f, "Content-Transfer-Encoding: %s\n", ENCODING(a->encoding)); /* Do NOT add the terminator here!!! */ - return (ferror(f) ? -1 : 0); + return ferror(f) ? -1 : 0; } /** @@ -468,8 +468,8 @@ int mutt_write_mime_header(struct Body *a, FILE *f) */ static bool write_as_text_part(struct Body *b) { - return (mutt_is_text_part(b) || - (((WithCrypto & APPLICATION_PGP) != 0) && mutt_is_application_pgp(b))); + return mutt_is_text_part(b) || + (((WithCrypto & APPLICATION_PGP) != 0) && mutt_is_application_pgp(b)); } /** @@ -507,7 +507,7 @@ int mutt_write_mime_body(struct Body *a, FILE *f) return -1; } fprintf(f, "\n--%s--\n", boundary); - return (ferror(f) ? -1 : 0); + return ferror(f) ? -1 : 0; } /* This is pretty gross, but it's the best solution for now... */ @@ -554,7 +554,7 @@ int mutt_write_mime_body(struct Body *a, FILE *f) SigInt = 0; return -1; } - return (ferror(f) ? -1 : 0); + return ferror(f) ? -1 : 0; } /** @@ -2368,7 +2368,7 @@ int mutt_rfc822_write_header(FILE *fp, struct Envelope *env, fprintf(fp, "User-Agent: NeoMutt/%s%s\n", PACKAGE_VERSION, GitVer); } - return (ferror(fp) == 0 ? 0 : -1); + return ferror(fp) == 0 ? 0 : -1; } /** @@ -2460,7 +2460,7 @@ static char *gen_msgid(void) snprintf(buf, sizeof(buf), "<%d%02d%02d%02d%02d%02d.%s@%s>", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, rndid, fqdn); - return (mutt_str_strdup(buf)); + return mutt_str_strdup(buf); } /** diff --git a/sidebar.c b/sidebar.c index 44943be6a2b..e1cbbe3d40c 100644 --- a/sidebar.c +++ b/sidebar.c @@ -589,7 +589,7 @@ static int select_page_down(void) if (Entries[HilIndex]->is_hidden) select_prev(); - return (orig_hil_index != HilIndex); + return orig_hil_index != HilIndex; } /** @@ -610,7 +610,7 @@ static int select_page_up(void) if (Entries[HilIndex]->is_hidden) select_next(); - return (orig_hil_index != HilIndex); + return orig_hil_index != HilIndex; } /** diff --git a/sort.c b/sort.c index 8fca09933b5..92b7c60f98a 100644 --- a/sort.c +++ b/sort.c @@ -68,7 +68,7 @@ static int compare_score(const void *a, const void *b) struct Header **pb = (struct Header **) b; int result = (*pb)->score - (*pa)->score; /* note that this is reverse */ result = perform_auxsort(result, a, b); - return (SORTCODE(result)); + return SORTCODE(result); } static int compare_size(const void *a, const void *b) @@ -77,7 +77,7 @@ static int compare_size(const void *a, const void *b) struct Header **pb = (struct Header **) b; int result = (*pa)->content->length - (*pb)->content->length; result = perform_auxsort(result, a, b); - return (SORTCODE(result)); + return SORTCODE(result); } static int compare_date_sent(const void *a, const void *b) @@ -86,7 +86,7 @@ static int compare_date_sent(const void *a, const void *b) struct Header **pb = (struct Header **) b; int result = (*pa)->date_sent - (*pb)->date_sent; result = perform_auxsort(result, a, b); - return (SORTCODE(result)); + return SORTCODE(result); } static int compare_subject(const void *a, const void *b) @@ -107,7 +107,7 @@ static int compare_subject(const void *a, const void *b) else rc = mutt_str_strcasecmp((*pa)->env->real_subj, (*pb)->env->real_subj); rc = perform_auxsort(rc, a, b); - return (SORTCODE(rc)); + return SORTCODE(rc); } const char *mutt_get_name(struct Address *a) @@ -121,7 +121,7 @@ const char *mutt_get_name(struct Address *a) else if (a->personal) return a->personal; else if (a->mailbox) - return (mutt_addr_for_display(a)); + return mutt_addr_for_display(a); } /* don't return NULL to avoid segfault when printing/comparing */ return ""; @@ -137,7 +137,7 @@ static int compare_to(const void *a, const void *b) const char *fb = mutt_get_name((*ppb)->env->to); int result = mutt_str_strncasecmp(fa, fb, SHORT_STRING); result = perform_auxsort(result, a, b); - return (SORTCODE(result)); + return SORTCODE(result); } static int compare_from(const void *a, const void *b) @@ -150,7 +150,7 @@ static int compare_from(const void *a, const void *b) const char *fb = mutt_get_name((*ppb)->env->from); int result = mutt_str_strncasecmp(fa, fb, SHORT_STRING); result = perform_auxsort(result, a, b); - return (SORTCODE(result)); + return SORTCODE(result); } static int compare_date_received(const void *a, const void *b) @@ -159,7 +159,7 @@ static int compare_date_received(const void *a, const void *b) struct Header **pb = (struct Header **) b; int result = (*pa)->received - (*pb)->received; result = perform_auxsort(result, a, b); - return (SORTCODE(result)); + return SORTCODE(result); } static int compare_order(const void *a, const void *b) @@ -168,7 +168,7 @@ static int compare_order(const void *a, const void *b) struct Header **hb = (struct Header **) b; /* no need to auxsort because you will never have equality here */ - return (SORTCODE((*ha)->index - (*hb)->index)); + return SORTCODE((*ha)->index - (*hb)->index); } static int compare_spam(const void *a, const void *b) @@ -187,15 +187,15 @@ static int compare_spam(const void *a, const void *b) /* If one msg has spam attr but other does not, sort the one with first. */ if (ahas && !bhas) - return (SORTCODE(1)); + return SORTCODE(1); if (!ahas && bhas) - return (SORTCODE(-1)); + return SORTCODE(-1); /* Else, if neither has a spam attr, presume equality. Fall back on aux. */ if (!ahas && !bhas) { result = perform_auxsort(result, a, b); - return (SORTCODE(result)); + return SORTCODE(result); } /* Both have spam attrs. */ @@ -210,7 +210,7 @@ static int compare_spam(const void *a, const void *b) /* If either aptr or bptr is equal to data, there is no numeric */ /* value for that spam attribute. In this case, compare lexically. */ if ((aptr == (*ppa)->env->spam->data) || (bptr == (*ppb)->env->spam->data)) - return (SORTCODE(strcmp(aptr, bptr))); + return SORTCODE(strcmp(aptr, bptr)); /* Otherwise, we have numeric value for both attrs. If these values */ /* are equal, then we first fall back upon string comparison, then */ @@ -224,7 +224,7 @@ static int compare_spam(const void *a, const void *b) } } - return (SORTCODE(result)); + return SORTCODE(result); } static int compare_label(const void *a, const void *b) @@ -241,20 +241,20 @@ static int compare_label(const void *a, const void *b) /* First we bias toward a message with a label, if the other does not. */ if (ahas && !bhas) - return (SORTCODE(-1)); + return SORTCODE(-1); if (!ahas && bhas) - return (SORTCODE(1)); + return SORTCODE(1); /* If neither has a label, use aux sort. */ if (!ahas && !bhas) { result = perform_auxsort(result, a, b); - return (SORTCODE(result)); + return SORTCODE(result); } /* If both have a label, we just do a lexical compare. */ result = mutt_str_strcasecmp((*ppa)->env->x_label, (*ppb)->env->x_label); - return (SORTCODE(result)); + return SORTCODE(result); } sort_t *mutt_get_sort_func(int method) diff --git a/test/acutest.h b/test/acutest.h index cd5ffb2c703..c56a0dd89d7 100644 --- a/test/acutest.h +++ b/test/acutest.h @@ -309,7 +309,7 @@ test_check__(int cond, const char* file, int line, const char* fmt, ...) test_current_already_logged__++; } - return (cond != 0); + return cond != 0; } void