2 * This file is part of mutt-ng, see http://www.muttng.org/.
3 * It's licensed under the GNU General Public License,
4 * please see the file GPL in the top level source directory.
16 rx_t *rx_compile (const char *s, int flags) {
17 rx_t *pp = safe_calloc (1, sizeof (rx_t));
19 pp->pattern = safe_strdup (s);
20 pp->rx = safe_calloc (1, sizeof (regex_t));
21 if (REGCOMP(pp->rx, NONULL (s), flags) != 0)
27 void rx_free (rx_t** p) {
34 int rx_compare (const rx_t* r1, const rx_t* r2) {
35 return (mutt_strcmp (r1->pattern, r2->pattern));
38 int rx_list_match (list2_t* l, const char* pat) {
40 if (!pat || !*pat || list_empty(l))
42 for (i = 0; i < l->length; i++)
43 if (REGEXEC(((rx_t*) l->data[i])->rx, pat) == 0)
48 int rx_lookup (list2_t* l, const char* pat) {
50 if (!pat || !*pat || list_empty(l))
52 for (i = 0; i < l->length; i++)
53 if (mutt_strcmp (((rx_t*) l->data[i])->pattern, pat) == 0)