if (pat->op == M_HEADER) {
if (*(buf = mutt_read_rfc822_line (fp, buf, &blen)) == '\0')
break;
- } if (fgets (buf, blen - 1, fp) == NULL)
+ } else if (fgets (buf, blen - 1, fp) == NULL)
break; /* don't loop forever */
if (patmatch (pat, buf) == 0) {
match = 1;
int r;
memset (&buf, 0, sizeof (buf));
+
if (mutt_extract_token (&buf, s, M_TOKEN_PATTERN | M_TOKEN_COMMENT) != 0 ||
!buf.data) {
snprintf (err->data, err->dsize, _("Error in expression: %s"), s->dptr);
return (-1);
}
+ if (!*buf.data) {
+ snprintf (err->data, err->dsize, _("Empty expression"));
+ return (-1);
+ }
+
#if 0
/* If there are no RE metacharacters, use simple search anyway */
if (!pat->stringmatch && !strpbrk (buf.data, "|[{.*+?^$"))
regfree (tmp->rx);
mem_free (&tmp->rx);
}
- mem_free (tmp->str);
+ mem_free (&tmp->str);
if (tmp->child)
mutt_pattern_free (&tmp->child);
mem_free (&tmp);
pattern_t *last = NULL;
int not = 0;
int alladdr = 0;
- int stringmatch = 0;
int or = 0;
int implicit = 1; /* used to detect logical AND operator */
struct pattern_flags *entry;
implicit = 0;
not = 0;
alladdr = 0;
- stringmatch = 0;
break;
case '=':
- stringmatch = 1;
/* fallthrough */
case '~':
if (implicit && or) {
tmp = new_pattern ();
tmp->not = not;
tmp->alladdr = alladdr;
- tmp->stringmatch = stringmatch;
+ tmp->stringmatch = (*ps.dptr == '=') ? 1 : 0;
not = 0;
alladdr = 0;
- stringmatch = 0;
if (last)
last->next = tmp;
case M_WHOLE_MSG:
#ifdef USE_IMAP
/* IMAP search sets h->matched at search compile time */
- if (Context->magic == M_IMAP && pat->stringmatch)
+ if (ctx->magic == M_IMAP && pat->stringmatch)
return (h->matched);
#endif
return (pat->not ^ msg_search (ctx, pat, h->msgno));