From: Federico Kircheis Date: Sat, 29 Jun 2019 12:56:18 +0000 (+0200) Subject: Replace `not` member with `pat_not` X-Git-Tag: 2019-10-25~149^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f91c70201b7d6521356e763159cd5f570ed508eb;p=neomutt Replace `not` member with `pat_not` It clashes with the alternate operators --- diff --git a/browser.c b/browser.c index 2b51fa34e..99917b0de 100644 --- a/browser.c +++ b/browser.c @@ -708,7 +708,7 @@ static int examine_directory(struct Menu *menu, struct BrowserState *state, if (prefix && *prefix && !mutt_str_startswith(mdata->group, prefix, CASE_MATCH)) continue; if (C_Mask && C_Mask->regex && - !((regexec(C_Mask->regex, mdata->group, 0, NULL, 0) == 0) ^ C_Mask->not)) + !((regexec(C_Mask->regex, mdata->group, 0, NULL, 0) == 0) ^ C_Mask->pat_not)) { continue; } @@ -767,7 +767,7 @@ static int examine_directory(struct Menu *menu, struct BrowserState *state, continue; } if (C_Mask && C_Mask->regex && - !((regexec(C_Mask->regex, de->d_name, 0, NULL, 0) == 0) ^ C_Mask->not)) + !((regexec(C_Mask->regex, de->d_name, 0, NULL, 0) == 0) ^ C_Mask->pat_not)) { continue; } diff --git a/config/regex.c b/config/regex.c index 60774e81b..9b8ef045c 100644 --- a/config/regex.c +++ b/config/regex.c @@ -166,7 +166,7 @@ static int regex_native_set(const struct ConfigSet *cs, void *var, if (orig && orig->pattern) { - const int flags = orig->not? DT_REGEX_ALLOW_NOT : 0; + const int flags = orig->pat_not ? DT_REGEX_ALLOW_NOT : 0; r = regex_new(orig->pattern, flags, err); if (!r) rc = CSR_ERR_INVALID; @@ -290,7 +290,7 @@ struct Regex *regex_new(const char *str, int flags, struct Buffer *err) /* Is a prefix of '!' allowed? */ if (((flags & DT_REGEX_ALLOW_NOT) != 0) && (str[0] == '!')) { - reg->not = true; + reg->pat_not = true; str++; } diff --git a/curs_lib.c b/curs_lib.c index 921e5aa30..64b9ff957 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -529,13 +529,12 @@ void mutt_perror_debug(const char *s) void mutt_flush_stdin(void) { int c; - do + do { c = fgetc(stdin); } while ((c != '\n') && (c != EOF)); } - /** * mutt_any_key_to_continue - Prompt the user to 'press any key' and wait * @param s Message prompt diff --git a/hook.c b/hook.c index ee5692cc3..c6c6acf48 100644 --- a/hook.c +++ b/hook.c @@ -89,7 +89,7 @@ enum CommandResult mutt_parse_hook(struct Buffer *buf, struct Buffer *s, struct Hook *ptr = NULL; struct Buffer cmd, pattern; int rc; - bool not = false, warning = false; + bool pat_not = false, warning = false; regex_t *rx = NULL; struct PatternHead *pat = NULL; char path[PATH_MAX]; @@ -103,7 +103,7 @@ enum CommandResult mutt_parse_hook(struct Buffer *buf, struct Buffer *s, { s->dptr++; SKIPWS(s->dptr); - not = true; + pat_not = true; } mutt_extract_token(&pattern, s, MUTT_TOKEN_NO_FLAGS); @@ -206,7 +206,7 @@ enum CommandResult mutt_parse_hook(struct Buffer *buf, struct Buffer *s, return MUTT_CMD_SUCCESS; } } - else if ((ptr->type == data) && (ptr->regex.not == not) && + else if ((ptr->type == data) && (ptr->regex.pat_not == pat_not) && (mutt_str_strcmp(pattern.data, ptr->regex.pattern) == 0)) { if (data & (MUTT_FOLDER_HOOK | MUTT_SEND_HOOK | MUTT_SEND2_HOOK | MUTT_MESSAGE_HOOK | @@ -276,7 +276,7 @@ enum CommandResult mutt_parse_hook(struct Buffer *buf, struct Buffer *s, ptr->pattern = pat; ptr->regex.pattern = pattern.data; ptr->regex.regex = rx; - ptr->regex.not = not; + ptr->regex.pat_not = pat_not; TAILQ_INSERT_TAIL(&Hooks, ptr, entries); return MUTT_CMD_SUCCESS; @@ -363,7 +363,7 @@ enum CommandResult mutt_parse_idxfmt_hook(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err) { enum CommandResult rc = MUTT_CMD_ERROR; - bool not = false; + bool pat_not = false; struct Buffer *name = mutt_buffer_pool_get(); struct Buffer *pattern = mutt_buffer_pool_get(); @@ -387,7 +387,7 @@ enum CommandResult mutt_parse_idxfmt_hook(struct Buffer *buf, struct Buffer *s, { s->dptr++; SKIPWS(s->dptr); - not = true; + pat_not = true; } mutt_extract_token(pattern, s, MUTT_TOKEN_NO_FLAGS); @@ -413,7 +413,7 @@ enum CommandResult mutt_parse_idxfmt_hook(struct Buffer *buf, struct Buffer *s, { TAILQ_FOREACH(hook, hl, entries) { - if ((hook->regex.not == not) && + if ((hook->regex.pat_not == pat_not) && (mutt_str_strcmp(mutt_b2s(pattern), hook->regex.pattern) == 0)) { mutt_str_replace(&hook->command, mutt_b2s(fmtstring)); @@ -438,7 +438,7 @@ enum CommandResult mutt_parse_idxfmt_hook(struct Buffer *buf, struct Buffer *s, hook->pattern = pat; hook->regex.pattern = mutt_str_strdup(mutt_b2s(pattern)); hook->regex.regex = NULL; - hook->regex.not = not; + hook->regex.pat_not = pat_not; if (!hl) { @@ -531,8 +531,8 @@ void mutt_folder_hook(const char *path, const char *desc) if (!(tmp->type & MUTT_FOLDER_HOOK)) continue; - if ((path && (regexec(tmp->regex.regex, path, 0, NULL, 0) == 0) ^ tmp->regex.not) || - (desc && (regexec(tmp->regex.regex, desc, 0, NULL, 0) == 0) ^ tmp->regex.not)) + if ((path && (regexec(tmp->regex.regex, path, 0, NULL, 0) == 0) ^ tmp->regex.pat_not) || + (desc && (regexec(tmp->regex.regex, desc, 0, NULL, 0) == 0) ^ tmp->regex.pat_not)) { if (mutt_parse_rc_line(tmp->command, token, err) == MUTT_CMD_ERROR) { @@ -593,7 +593,7 @@ void mutt_message_hook(struct Mailbox *m, struct Email *e, HookFlags type) if (hook->type & type) { if ((mutt_pattern_exec(SLIST_FIRST(hook->pattern), 0, m, e, &cache) > 0) ^ - hook->regex.not) + hook->regex.pat_not) { if (mutt_parse_rc_line(hook->command, token, err) == MUTT_CMD_ERROR) { @@ -642,7 +642,7 @@ static int addr_hook(char *path, size_t pathlen, HookFlags type, { struct Mailbox *m = ctx ? ctx->mailbox : NULL; if ((mutt_pattern_exec(SLIST_FIRST(hook->pattern), 0, m, e, &cache) > 0) ^ - hook->regex.not) + hook->regex.pat_not) { mutt_make_string_flags(path, pathlen, hook->command, ctx, m, e, MUTT_FORMAT_PLAIN); return 0; @@ -733,7 +733,7 @@ static void list_hook(struct ListHead *matches, const char *match, HookFlags hoo { if ((tmp->type & hook) && ((match && (regexec(tmp->regex.regex, match, 0, NULL, 0) == 0)) ^ - tmp->regex.not)) + tmp->regex.pat_not)) { mutt_list_insert_tail(matches, mutt_str_strdup(tmp->command)); } @@ -776,7 +776,7 @@ void mutt_account_hook(const char *url) if (!(hook->command && (hook->type & MUTT_ACCOUNT_HOOK))) continue; - if ((regexec(hook->regex.regex, url, 0, NULL, 0) == 0) ^ hook->regex.not) + if ((regexec(hook->regex.regex, url, 0, NULL, 0) == 0) ^ hook->regex.pat_not) { inhook = true; @@ -895,7 +895,7 @@ const char *mutt_idxfmt_hook(const char *name, struct Mailbox *m, struct Email * TAILQ_FOREACH(hook, hl, entries) { struct Pattern *pat = SLIST_FIRST(hook->pattern); - if ((mutt_pattern_exec(pat, 0, m, e, &cache) > 0) ^ hook->regex.not) + if ((mutt_pattern_exec(pat, 0, m, e, &cache) > 0) ^ hook->regex.pat_not) { fmtstring = hook->command; break; diff --git a/imap/browse.c b/imap/browse.c index 203494208..4de11b8df 100644 --- a/imap/browse.c +++ b/imap/browse.c @@ -90,7 +90,7 @@ static void add_folder(char delim, char *folder, bool noselect, bool noinferiors * than at scan, since it's so expensive to scan. But that's big changes * to browser.c */ if (C_Mask && C_Mask->regex && - !((regexec(C_Mask->regex, relpath, 0, NULL, 0) == 0) ^ C_Mask->not)) + !((regexec(C_Mask->regex, relpath, 0, NULL, 0) == 0) ^ C_Mask->pat_not)) { return; } diff --git a/imap/imap.c b/imap/imap.c index 5dc84b9de..f04f63df4 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -387,7 +387,7 @@ static int compile_search(struct Mailbox *m, const struct PatternHead *pat, stru if (do_search(pat, false) == 0) return 0; - if (firstpat->not) + if (firstpat->pat_not) mutt_buffer_addstr(buf, "NOT "); if (firstpat->child) diff --git a/mutt/charset.c b/mutt/charset.c index f8f6912d7..45215d82b 100644 --- a/mutt/charset.c +++ b/mutt/charset.c @@ -466,7 +466,7 @@ bool mutt_ch_lookup_add(enum LookupType type, const char *pat, l->replacement = mutt_str_strdup(replace); l->regex.pattern = mutt_str_strdup(pat); l->regex.regex = rx; - l->regex.not = false; + l->regex.pat_not = false; TAILQ_INSERT_TAIL(&Lookups, l, entries); diff --git a/mutt/regex.c b/mutt/regex.c index 2c52305c5..f2ee83124 100644 --- a/mutt/regex.c +++ b/mutt/regex.c @@ -88,7 +88,7 @@ struct Regex *mutt_regex_new(const char *str, int flags, struct Buffer *err) /* Is a prefix of '!' allowed? */ if (((flags & DT_REGEX_ALLOW_NOT) != 0) && (str[0] == '!')) { - reg->not = true; + reg->pat_not = true; str++; } diff --git a/mutt/regex3.h b/mutt/regex3.h index 2ec72a15d..f43259c74 100644 --- a/mutt/regex3.h +++ b/mutt/regex3.h @@ -58,7 +58,7 @@ struct Regex { char *pattern; /**< printable version */ regex_t *regex; /**< compiled expression */ - bool not; /**< do not match */ + bool pat_not; /**< do not match */ }; /** diff --git a/pattern.c b/pattern.c index 8f39c3538..d89a909b3 100644 --- a/pattern.c +++ b/pattern.c @@ -1393,7 +1393,7 @@ struct PatternHead *mutt_pattern_comp(const char *s, int flags, struct Buffer *e struct PatternHead *curlist = NULL; struct PatternHead *tmp = NULL, *tmp2 = NULL; struct PatternHead *last = NULL; - bool not = false; + bool pat_not = false; bool alladdr = false; bool or = false; bool implicit = true; /* used to detect logical AND operator */ @@ -1419,7 +1419,7 @@ struct PatternHead *mutt_pattern_comp(const char *s, int flags, struct Buffer *e break; case '!': ps.dptr++; - not = !not; + pat_not = !pat_not; break; case '@': ps.dptr++; @@ -1452,7 +1452,7 @@ struct PatternHead *mutt_pattern_comp(const char *s, int flags, struct Buffer *e } ps.dptr++; implicit = false; - not = false; + pat_not = false; alladdr = false; isalias = false; break; @@ -1492,10 +1492,10 @@ struct PatternHead *mutt_pattern_comp(const char *s, int flags, struct Buffer *e else curlist = tmp; last = tmp; - pat->not ^= not; + pat->pat_not ^= pat_not; pat->alladdr |= alladdr; pat->isalias |= isalias; - not = false; + pat_not = false; alladdr = false; isalias = false; /* compile the sub-expression */ @@ -1525,12 +1525,12 @@ struct PatternHead *mutt_pattern_comp(const char *s, int flags, struct Buffer *e tmp = mutt_pattern_node_new(); pat = SLIST_FIRST(tmp); - pat->not = not; + pat->pat_not = pat_not; pat->alladdr = alladdr; pat->isalias = isalias; pat->stringmatch = (ps.dptr[0] == '='); pat->groupmatch = (ps.dptr[0] == '%'); - not = false; + pat_not = false; alladdr = false; isalias = false; @@ -1596,10 +1596,10 @@ struct PatternHead *mutt_pattern_comp(const char *s, int flags, struct Buffer *e curlist = tmp; last = tmp; pat = SLIST_FIRST(tmp); - pat->not ^= not; + pat->pat_not ^= pat_not; pat->alladdr |= alladdr; pat->isalias |= isalias; - not = false; + pat_not = false; alladdr = false; isalias = false; ps.dptr = p + 1; /* restore location */ @@ -2008,47 +2008,48 @@ int mutt_pattern_exec(struct Pattern *pat, PatternExecFlags flags, switch (pat->op) { case MUTT_PAT_AND: - return pat->not^(perform_and(pat->child, flags, m, e, cache) > 0); + return pat->pat_not ^ (perform_and(pat->child, flags, m, e, cache) > 0); case MUTT_PAT_OR: - return pat->not^(perform_or(pat->child, flags, m, e, cache) > 0); + return pat->pat_not ^ (perform_or(pat->child, flags, m, e, cache) > 0); case MUTT_PAT_THREAD: - return pat->not^match_threadcomplete(pat->child, flags, m, e->thread, 1, 1, 1, 1); + return pat->pat_not ^ + match_threadcomplete(pat->child, flags, m, e->thread, 1, 1, 1, 1); case MUTT_PAT_PARENT: - return pat->not^match_threadparent(pat->child, flags, m, e->thread); + return pat->pat_not ^ match_threadparent(pat->child, flags, m, e->thread); case MUTT_PAT_CHILDREN: - return pat->not^match_threadchildren(pat->child, flags, m, e->thread); + return pat->pat_not ^ match_threadchildren(pat->child, flags, m, e->thread); case MUTT_ALL: - return !pat->not; + return !pat->pat_not; case MUTT_EXPIRED: - return pat->not^e->expired; + return pat->pat_not ^ e->expired; case MUTT_SUPERSEDED: - return pat->not^e->superseded; + return pat->pat_not ^ e->superseded; case MUTT_FLAG: - return pat->not^e->flagged; + return pat->pat_not ^ e->flagged; case MUTT_TAG: - return pat->not^e->tagged; + return pat->pat_not ^ e->tagged; case MUTT_NEW: - return pat->not? e->old || e->read : !(e->old || e->read); + return pat->pat_not ? e->old || e->read : !(e->old || e->read); case MUTT_UNREAD: - return pat->not? e->read : !e->read; + return pat->pat_not ? e->read : !e->read; case MUTT_REPLIED: - return pat->not^e->replied; + return pat->pat_not ^ e->replied; case MUTT_OLD: - return pat->not? (!e->old || e->read) : (e->old && !e->read); + return pat->pat_not ? (!e->old || e->read) : (e->old && !e->read); case MUTT_READ: - return pat->not^e->read; + return pat->pat_not ^ e->read; case MUTT_DELETED: - return pat->not^e->deleted; + return pat->pat_not ^ e->deleted; case MUTT_PAT_MESSAGE: - return pat->not^((EMSG(e) >= pat->min) && (EMSG(e) <= pat->max)); + return pat->pat_not ^ ((EMSG(e) >= pat->min) && (EMSG(e) <= pat->max)); case MUTT_PAT_DATE: if (pat->dynamic) match_update_dynamic_date(pat); - return pat->not^(e->date_sent >= pat->min && e->date_sent <= pat->max); + return pat->pat_not ^ (e->date_sent >= pat->min && e->date_sent <= pat->max); case MUTT_PAT_DATE_RECEIVED: if (pat->dynamic) match_update_dynamic_date(pat); - return pat->not^(e->received >= pat->min && e->received <= pat->max); + return pat->pat_not ^ (e->received >= pat->min && e->received <= pat->max); case MUTT_PAT_BODY: case MUTT_PAT_HEADER: case MUTT_PAT_WHOLE_MSG: @@ -2063,7 +2064,7 @@ int mutt_pattern_exec(struct Pattern *pat, PatternExecFlags flags, if ((m->magic == MUTT_IMAP) && pat->stringmatch) return e->matched; #endif - return pat->not^msg_search(m, pat, e->msgno); + return pat->pat_not ^ msg_search(m, pat, e->msgno); case MUTT_PAT_SERVERSEARCH: #ifdef USE_IMAP if (!m) @@ -2083,54 +2084,55 @@ int mutt_pattern_exec(struct Pattern *pat, PatternExecFlags flags, case MUTT_PAT_SENDER: if (!e->env) return 0; - return pat->not^match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 1, - &e->env->sender); + return pat->pat_not ^ match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), + 1, &e->env->sender); case MUTT_PAT_FROM: if (!e->env) return 0; - return pat->not^match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 1, - &e->env->from); + return pat->pat_not ^ + match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 1, &e->env->from); case MUTT_PAT_TO: if (!e->env) return 0; - return pat->not^match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 1, - &e->env->to); + return pat->pat_not ^ + match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 1, &e->env->to); case MUTT_PAT_CC: if (!e->env) return 0; - return pat->not^match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 1, - &e->env->cc); + return pat->pat_not ^ + match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 1, &e->env->cc); case MUTT_PAT_SUBJECT: if (!e->env) return 0; - return pat->not^(e->env->subject &&patmatch(pat, e->env->subject)); + return pat->pat_not ^ (e->env->subject && patmatch(pat, e->env->subject)); case MUTT_PAT_ID: case MUTT_PAT_ID_EXTERNAL: if (!e->env) return 0; - return pat->not^(e->env->message_id &&patmatch(pat, e->env->message_id)); + return pat->pat_not ^ (e->env->message_id && patmatch(pat, e->env->message_id)); case MUTT_PAT_SCORE: - return pat->not^(e->score >= pat->min && - (pat->max == MUTT_MAXRANGE || e->score <= pat->max)); + return pat->pat_not ^ (e->score >= pat->min && + (pat->max == MUTT_MAXRANGE || e->score <= pat->max)); case MUTT_PAT_SIZE: - return pat->not^(e->content->length >= pat->min && - (pat->max == MUTT_MAXRANGE || e->content->length <= pat->max)); + return pat->pat_not ^ + (e->content->length >= pat->min && + (pat->max == MUTT_MAXRANGE || e->content->length <= pat->max)); case MUTT_PAT_REFERENCE: if (!e->env) return 0; - return pat->not^(match_reference(pat, &e->env->references) || - match_reference(pat, &e->env->in_reply_to)); + return pat->pat_not ^ (match_reference(pat, &e->env->references) || + match_reference(pat, &e->env->in_reply_to)); case MUTT_PAT_ADDRESS: if (!e->env) return 0; - return pat->not^match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 4, - &e->env->from, &e->env->sender, - &e->env->to, &e->env->cc); + return pat->pat_not ^ match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), + 4, &e->env->from, &e->env->sender, + &e->env->to, &e->env->cc); case MUTT_PAT_RECIPIENT: if (!e->env) return 0; - return pat->not^match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 2, - &e->env->to, &e->env->cc); + return pat->pat_not ^ match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), + 2, &e->env->to, &e->env->cc); case MUTT_PAT_LIST: /* known list, subscribed or not */ { if (!e->env) @@ -2149,7 +2151,7 @@ int mutt_pattern_exec(struct Pattern *pat, PatternExecFlags flags, } else result = mutt_is_list_recipient(pat->alladdr, e->env); - return pat->not^result; + return pat->pat_not ^ result; } case MUTT_PAT_SUBSCRIBED_LIST: { @@ -2169,7 +2171,7 @@ int mutt_pattern_exec(struct Pattern *pat, PatternExecFlags flags, } else result = mutt_is_subscribed_list_recipient(pat->alladdr, e->env); - return pat->not^result; + return pat->pat_not ^ result; } case MUTT_PAT_PERSONAL_RECIP: { @@ -2189,7 +2191,7 @@ int mutt_pattern_exec(struct Pattern *pat, PatternExecFlags flags, } else result = match_user(pat->alladdr, &e->env->to, &e->env->cc); - return pat->not^result; + return pat->pat_not ^ result; } case MUTT_PAT_PERSONAL_FROM: { @@ -2207,65 +2209,65 @@ int mutt_pattern_exec(struct Pattern *pat, PatternExecFlags flags, } else result = match_user(pat->alladdr, &e->env->from, NULL); - return pat->not^result; + return pat->pat_not ^ result; } case MUTT_PAT_COLLAPSED: - return pat->not^(e->collapsed && e->num_hidden > 1); + return pat->pat_not ^ (e->collapsed && e->num_hidden > 1); case MUTT_PAT_CRYPT_SIGN: if (!WithCrypto) break; - return pat->not^((e->security & SEC_SIGN) ? 1 : 0); + return pat->pat_not ^ ((e->security & SEC_SIGN) ? 1 : 0); case MUTT_PAT_CRYPT_VERIFIED: if (!WithCrypto) break; - return pat->not^((e->security & SEC_GOODSIGN) ? 1 : 0); + return pat->pat_not ^ ((e->security & SEC_GOODSIGN) ? 1 : 0); case MUTT_PAT_CRYPT_ENCRYPT: if (!WithCrypto) break; - return pat->not^((e->security & SEC_ENCRYPT) ? 1 : 0); + return pat->pat_not ^ ((e->security & SEC_ENCRYPT) ? 1 : 0); case MUTT_PAT_PGP_KEY: if (!(WithCrypto & APPLICATION_PGP)) break; - return pat->not^((e->security & PGP_KEY) == PGP_KEY); + return pat->pat_not ^ ((e->security & PGP_KEY) == PGP_KEY); case MUTT_PAT_XLABEL: if (!e->env) return 0; - return pat->not^(e->env->x_label &&patmatch(pat, e->env->x_label)); + return pat->pat_not ^ (e->env->x_label && patmatch(pat, e->env->x_label)); case MUTT_PAT_DRIVER_TAGS: { char *tags = driver_tags_get(&e->tags); - bool rc = (pat->not^(tags &&patmatch(pat, tags))); + bool rc = (pat->pat_not ^ (tags && patmatch(pat, tags))); FREE(&tags); return rc; } case MUTT_PAT_HORMEL: if (!e->env) return 0; - return pat->not^(e->env->spam && e->env->spam->data && - patmatch(pat, e->env->spam->data)); + return pat->pat_not ^ (e->env->spam && e->env->spam->data && + patmatch(pat, e->env->spam->data)); case MUTT_PAT_DUPLICATED: - return pat->not^(e->thread && e->thread->duplicate_thread); + return pat->pat_not ^ (e->thread && e->thread->duplicate_thread); case MUTT_PAT_MIMEATTACH: if (!m) return 0; { int count = mutt_count_body_parts(m, e); - return pat->not^(count >= pat->min && - (pat->max == MUTT_MAXRANGE || count <= pat->max)); + return pat->pat_not ^ (count >= pat->min && + (pat->max == MUTT_MAXRANGE || count <= pat->max)); } case MUTT_PAT_MIMETYPE: if (!m) return 0; - return pat->not^match_mime_content_type(pat, m, e); + return pat->pat_not ^ match_mime_content_type(pat, m, e); case MUTT_PAT_UNREFERENCED: - return pat->not^(e->thread && !e->thread->child); + return pat->pat_not ^ (e->thread && !e->thread->child); case MUTT_PAT_BROKEN: - return pat->not^(e->thread && e->thread->fake_thread); + return pat->pat_not ^ (e->thread && e->thread->fake_thread); #ifdef USE_NNTP case MUTT_PAT_NEWSGROUPS: if (!e->env) return 0; - return pat->not^(e->env->newsgroups &&patmatch(pat, e->env->newsgroups)); + return pat->pat_not ^ (e->env->newsgroups && patmatch(pat, e->env->newsgroups)); #endif } mutt_error(_("error: unknown op %d (report this error)"), pat->op); diff --git a/pattern.h b/pattern.h index 55cc5a4d9..51ae478db 100644 --- a/pattern.h +++ b/pattern.h @@ -47,7 +47,7 @@ extern bool C_ThoroughSearch; struct Pattern { short op; - bool not : 1; + bool pat_not : 1; bool alladdr : 1; bool stringmatch : 1; bool groupmatch : 1; diff --git a/test/config/regex.c b/test/config/regex.c index cad24e5e7..5baeed337 100644 --- a/test/config/regex.c +++ b/test/config/regex.c @@ -342,7 +342,7 @@ static bool test_native_set(struct ConfigSet *cs, struct Buffer *err) TEST_MSG("%s\n", err->data); goto tns_out; } - TEST_MSG("'%s', not flag set to %d\n", VarIlama->pattern, VarIlama->not); + TEST_MSG("'%s', not flag set to %d\n", VarIlama->pattern, VarIlama->pat_not); name = "Jackfruit"; mutt_buffer_reset(err); diff --git a/test/pattern/comp.c b/test/pattern/comp.c index da1012e32..ca8b4ea4c 100644 --- a/test/pattern/comp.c +++ b/test/pattern/comp.c @@ -98,7 +98,7 @@ static int canonical_pattern(char *s, struct PatternHead *pat, int indent) { p += sprintf(p, "{"); p += sprintf(p, "%d,", e->op); - p += sprintf(p, "%d,", e->not); + p += sprintf(p, "%d,", e->pat_not); p += sprintf(p, "%d,", e->alladdr); p += sprintf(p, "%d,", e->stringmatch); p += sprintf(p, "%d,", e->groupmatch); @@ -141,7 +141,7 @@ static int cmp_pattern(struct PatternHead *p1, struct PatternHead *p2) if (l->op != r->op) return 1; - if (l->not != r->not) + if (l->pat_not != r->pat_not) return 1; if (l->alladdr != r->alladdr) return 1; @@ -269,7 +269,7 @@ void test_mutt_pattern_comp(void) struct PatternHead expected; SLIST_INIT(&expected); struct Pattern e = { .op = MUTT_PAT_SUBJECT, - .not = false, + .pat_not = false, .alladdr = false, .stringmatch = true, .groupmatch = false, @@ -315,7 +315,7 @@ void test_mutt_pattern_comp(void) struct PatternHead expected; SLIST_INIT(&expected); struct Pattern e = { .op = MUTT_PAT_SUBJECT, - .not = true, + .pat_not = true, .alladdr = false, .stringmatch = true, .groupmatch = false, @@ -363,7 +363,7 @@ void test_mutt_pattern_comp(void) struct Pattern e[3] = { /* root */ { .op = MUTT_PAT_AND, - .not = false, + .pat_not = false, .alladdr = false, .stringmatch = false, .groupmatch = false, @@ -375,7 +375,7 @@ void test_mutt_pattern_comp(void) .p.str = NULL }, /* root->child */ { .op = MUTT_PAT_SUBJECT, - .not = false, + .pat_not = false, .alladdr = false, .stringmatch = true, .groupmatch = false, @@ -387,7 +387,7 @@ void test_mutt_pattern_comp(void) .p.str = "foo" }, /* root->child->next */ { .op = MUTT_PAT_SUBJECT, - .not = false, + .pat_not = false, .alladdr = false, .stringmatch = true, .groupmatch = false, @@ -442,7 +442,7 @@ void test_mutt_pattern_comp(void) struct Pattern e[3] = { /* root */ { .op = MUTT_PAT_AND, - .not = false, + .pat_not = false, .alladdr = false, .stringmatch = false, .groupmatch = false, @@ -454,7 +454,7 @@ void test_mutt_pattern_comp(void) .p.str = NULL }, /* root->child */ { .op = MUTT_PAT_SUBJECT, - .not = false, + .pat_not = false, .alladdr = false, .stringmatch = true, .groupmatch = false, @@ -466,7 +466,7 @@ void test_mutt_pattern_comp(void) .p.str = "foo" }, /* root->child->next */ { .op = MUTT_PAT_SUBJECT, - .not = false, + .pat_not = false, .alladdr = false, .stringmatch = true, .groupmatch = false, @@ -521,7 +521,7 @@ void test_mutt_pattern_comp(void) struct Pattern e[3] = { /* root */ { .op = MUTT_PAT_AND, - .not = true, + .pat_not = true, .alladdr = false, .stringmatch = false, .groupmatch = false, @@ -533,7 +533,7 @@ void test_mutt_pattern_comp(void) .p.str = NULL }, /* root->child */ { .op = MUTT_PAT_SUBJECT, - .not = false, + .pat_not = false, .alladdr = false, .stringmatch = true, .groupmatch = false, @@ -545,7 +545,7 @@ void test_mutt_pattern_comp(void) .p.str = "foo" }, /* root->child->next */ { .op = MUTT_PAT_SUBJECT, - .not = false, + .pat_not = false, .alladdr = false, .stringmatch = true, .groupmatch = false, @@ -600,7 +600,7 @@ void test_mutt_pattern_comp(void) struct Pattern e[4] = { /* root */ { .op = MUTT_PAT_AND, - .not = false, + .pat_not = false, .alladdr = false, .stringmatch = false, .groupmatch = false, @@ -612,7 +612,7 @@ void test_mutt_pattern_comp(void) .p.str = NULL }, /* root->child */ { .op = MUTT_PAT_SUBJECT, - .not = false, + .pat_not = false, .alladdr = false, .stringmatch = true, .groupmatch = false, @@ -624,7 +624,7 @@ void test_mutt_pattern_comp(void) .p.str = "foo" }, /* root->child->next */ { .op = MUTT_PAT_SUBJECT, - .not = false, + .pat_not = false, .alladdr = false, .stringmatch = true, .groupmatch = false, @@ -636,7 +636,7 @@ void test_mutt_pattern_comp(void) .p.str = "bar" }, /* root->child->next->next */ { .op = MUTT_PAT_SUBJECT, - .not = false, + .pat_not = false, .alladdr = false, .stringmatch = true, .groupmatch = false, @@ -691,7 +691,7 @@ void test_mutt_pattern_comp(void) struct Pattern e[5] = { /* root */ { .op = MUTT_PAT_AND, - .not = false, + .pat_not = false, .alladdr = false, .stringmatch = false, .groupmatch = false, @@ -703,7 +703,7 @@ void test_mutt_pattern_comp(void) .p.str = NULL }, /* root->child */ { .op = MUTT_PAT_OR, - .not = true, + .pat_not = true, .alladdr = false, .stringmatch = false, .groupmatch = false, @@ -715,7 +715,7 @@ void test_mutt_pattern_comp(void) .p.str = NULL }, /* root->child->child */ { .op = MUTT_PAT_SUBJECT, - .not = false, + .pat_not = false, .alladdr = false, .stringmatch = true, .groupmatch = false, @@ -727,7 +727,7 @@ void test_mutt_pattern_comp(void) .p.str = "foo" }, /* root->child->child->next */ { .op = MUTT_PAT_SUBJECT, - .not = false, + .pat_not = false, .alladdr = false, .stringmatch = true, .groupmatch = false, @@ -739,7 +739,7 @@ void test_mutt_pattern_comp(void) .p.str = "bar" }, /* root->child->next */ { .op = MUTT_PAT_SUBJECT, - .not = false, + .pat_not = false, .alladdr = false, .stringmatch = true, .groupmatch = false,