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.
11 #include <lib-lib/mem.h>
17 rx_t *rx_compile (const char *s, int flags) {
18 rx_t *pp = p_new(rx_t, 1);
20 pp->pattern = str_dup (s);
21 pp->rx = p_new(regex_t, 1);
22 if (REGCOMP(pp->rx, NONULL (s), flags) != 0)
28 void rx_free (rx_t** p) {
29 p_delete(&(*p)->pattern);
35 int rx_compare (const rx_t* r1, const rx_t* r2) {
36 return (str_cmp (r1->pattern, r2->pattern));
39 int rx_list_match (list2_t* l, const char* pat) {
41 if (!pat || !*pat || list_empty(l))
43 for (i = 0; i < l->length; i++)
44 if (REGEXEC(((rx_t*) l->data[i])->rx, pat) == 0)
49 int rx_lookup (list2_t* l, const char* pat) {
51 if (!pat || !*pat || list_empty(l))
53 for (i = 0; i < l->length; i++)
54 if (str_cmp (((rx_t*) l->data[i])->pattern, pat) == 0)