From: Richard Russon Date: Sun, 21 Apr 2019 21:08:05 +0000 (+0100) Subject: boolify pattern functions X-Git-Tag: 2019-10-25~245^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d3a3789344b1317c4c8d455dc6460ba73c438cdb;p=neomutt boolify pattern functions --- diff --git a/pattern.c b/pattern.c index bf8599d95..a9ecf1337 100644 --- a/pattern.c +++ b/pattern.c @@ -1890,24 +1890,24 @@ static int match_threadchildren(struct PatternHead *pat, PatternExecFlags flags, * match_content_type - Match a Pattern against an Attachment's Content-Type * @param pat Pattern to match * @param b Attachment - * @retval 1 Success, pattern matched - * @retval 0 Pattern did not match + * @retval true Success, pattern matched + * @retval false Pattern did not match */ -static int match_content_type(const struct Pattern *pat, struct Body *b) +static bool match_content_type(const struct Pattern *pat, struct Body *b) { - char buf[256]; if (!b) - return 0; + return false; + char buf[256]; snprintf(buf, sizeof(buf), "%s/%s", TYPE(b), b->subtype); if (patmatch(pat, buf) == 0) - return 1; + return true; if (match_content_type(pat, b->parts)) - return 1; + return true; if (match_content_type(pat, b->next)) - return 1; - return 0; + return true; + return false; } /** @@ -1931,10 +1931,10 @@ static bool match_update_dynamic_date(struct Pattern *pat) * @param pat Pattern to match * @param m Mailbox * @param e Email - * @retval 1 Success, pattern matched - * @retval 0 Pattern did not match + * @retval true Success, pattern matched + * @retval false Pattern did not match */ -static int match_mime_content_type(const struct Pattern *pat, struct Mailbox *m, +static bool match_mime_content_type(const struct Pattern *pat, struct Mailbox *m, struct Email *e) { mutt_parse_mime_message(m, e);