Skip to content

Commit

Permalink
Remove parentheses from all return statments
Browse files Browse the repository at this point in the history
`return` is a statement, not a function.
  • Loading branch information
BertramScharpf authored and flatcap committed Jul 19, 2018
1 parent bf5af24 commit e80b819
Show file tree
Hide file tree
Showing 59 changed files with 256 additions and 252 deletions.
2 changes: 1 addition & 1 deletion addrbook.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion alias.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
22 changes: 11 additions & 11 deletions browser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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;
}

/**
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions color.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions complete.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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;
}
4 changes: 2 additions & 2 deletions compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static int lock_realpath(struct Context *ctx, int excl)
return 1;
}

return (r == 0);
return r == 0;
}

/**
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions conn/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions conn/ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand Down Expand Up @@ -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;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion conn/ssl_gnutls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions curs_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion curs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
6 changes: 3 additions & 3 deletions email/address.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand All @@ -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)
{
Expand Down Expand Up @@ -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;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions email/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions email/rfc2047.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions email/rfc2231.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion group.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ static unsigned char decode_byte(char ch)
{
if (ch == 96)
return 0;
return (ch - 32);
return ch - 32;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions hcache/hcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -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;
}
8 changes: 4 additions & 4 deletions hdrline.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
Loading

0 comments on commit e80b819

Please sign in to comment.