X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=pattern.c;h=e4d7caa998df1815be192b4bc129791228a4d3ee;hp=1ca87e42030778254f55fff5fda0515d71a705d3;hb=c98480f8568e6c1bc927c6c5f2b5e80b4aa6548c;hpb=8e037c67a88cb4680c4391134c578e3b55a80f8a diff --git a/pattern.c b/pattern.c index 1ca87e4..e4d7caa 100644 --- a/pattern.c +++ b/pattern.c @@ -12,21 +12,21 @@ #endif #include +#include +#include +#include +#include +#include #include "mutt.h" -#include "buffer.h" #include "handler.h" #include "enter.h" -#include "ascii.h" #include "mx.h" #include "mapping.h" #include "keymap.h" #include "copy.h" #include "mime.h" -#include "lib/mem.h" -#include "lib/intl.h" -#include "lib/str.h" #ifdef USE_IMAP #include "mx.h" @@ -164,7 +164,7 @@ msg_search (CONTEXT *ctx, pattern_t* pat, int msgno) if ((msg = mx_open_message (ctx, msgno)) != NULL) { if (option (OPTTHOROUGHSRC)) { /* decode the header / body */ - memset (&s, 0, sizeof (s)); + p_clear(&s, 1); s.fpin = msg->fp; s.flags = M_CHARCONV; mutt_mktemp (tempfile); @@ -226,7 +226,7 @@ msg_search (CONTEXT *ctx, pattern_t* pat, int msgno) match = 1; break; } - lng -= str_len (buf); + lng -= m_strlen(buf); } p_delete(&buf); @@ -247,7 +247,7 @@ int eat_regexp (pattern_t * pat, BUFFER * s, BUFFER * err) BUFFER buf; int r; - memset (&buf, 0, sizeof (buf)); + p_clear(&buf, 1); if (mutt_extract_token (&buf, s, M_TOKEN_PATTERN | M_TOKEN_COMMENT) != 0 || !buf.data) { @@ -267,7 +267,7 @@ int eat_regexp (pattern_t * pat, BUFFER * s, BUFFER * err) #endif if (pat->stringmatch) { - pat->str = str_dup (buf.data); + pat->str = m_strdup(buf.data); p_delete(&buf.data); } else { pat->rx = p_new(regex_t, 1); @@ -537,21 +537,21 @@ static int eat_date (pattern_t * pat, BUFFER * s, BUFFER * err) BUFFER buffer; struct tm min, max; - memset (&buffer, 0, sizeof (buffer)); + p_clear(&buffer, 1); if (mutt_extract_token (&buffer, s, M_TOKEN_COMMENT | M_TOKEN_PATTERN) != 0 || !buffer.data) { strfcpy (err->data, _("error in expression"), err->dsize); return (-1); } - memset (&min, 0, sizeof (min)); + p_clear(&min, 1); /* the `0' time is Jan 1, 1970 UTC, so in order to prevent a negative time when doing timezone conversion, we use Jan 2, 1970 UTC as the base here */ min.tm_mday = 2; min.tm_year = 70; - memset (&max, 0, sizeof (max)); + p_clear(&max, 1); /* Arbitrary year in the future. Don't set this too high or mutt_mktime() returns something larger than will @@ -713,9 +713,9 @@ pattern_t *mutt_pattern_comp ( /* const */ char *s, int flags, BUFFER * err) char *buf; BUFFER ps; - memset (&ps, 0, sizeof (ps)); + p_clear(&ps, 1); ps.dptr = s; - ps.dsize = str_len (s); + ps.dsize = m_strlen(s); while (*ps.dptr) { SKIPWS (ps.dptr); @@ -1171,7 +1171,7 @@ void mutt_check_simple (char *s, size_t len, const char *simple) if (!strchr (s, '~') && !strchr (s, '=')) { /* yup, so spoof a real request */ /* convert old tokens into the new format */ - if (ascii_strcasecmp ("all", s) == 0 || !str_cmp ("^", s) || !str_cmp (".", s)) /* ~A is more efficient */ + if (ascii_strcasecmp ("all", s) == 0 || !m_strcmp("^", s) || !m_strcmp(".", s)) /* ~A is more efficient */ strfcpy (s, "~A", len); else if (ascii_strcasecmp ("del", s) == 0) strfcpy (s, "~D", len); @@ -1210,7 +1210,7 @@ int mutt_pattern_func (int op, char *prompt) mutt_message _("Compiling search pattern..."); - simple = str_dup (buf); + simple = m_strdup(buf); mutt_check_simple (buf, sizeof (buf), NONULL (SimpleSearch)); err.data = error; @@ -1289,7 +1289,7 @@ int mutt_pattern_func (int op, char *prompt) } /* record new limit pattern, unless match all */ - if (str_ncmp (buf, "~A", 2) != 0) { + if (m_strncmp(buf, "~A", 2) != 0) { Context->pattern = simple; simple = NULL; /* don't clobber it */ Context->limit_pattern = mutt_pattern_comp (buf, M_FULL_MSG, &err); @@ -1327,7 +1327,7 @@ int mutt_search_command (int cur, int op) strfcpy (temp, buf, sizeof (temp)); mutt_check_simple (temp, sizeof (temp), NONULL (SimpleSearch)); - if (!SearchPattern || str_cmp (temp, LastSearchExpn)) { + if (!SearchPattern || m_strcmp(temp, LastSearchExpn)) { set_option (OPTSEARCHINVALID); strfcpy (LastSearch, buf, sizeof (LastSearch)); mutt_message _("Compiling search pattern...");