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.
12 rx_t *rx_compile (const char *s, int flags) {
13 rx_t *pp = safe_calloc (sizeof (rx_t), 1);
15 pp->pattern = safe_strdup (s);
16 pp->rx = safe_calloc (sizeof (regex_t), 1);
17 if (REGCOMP(pp->rx, NONULL (s), flags) != 0)
23 void rx_free (rx_t** p) {
30 int rx_compare (const rx_t* r1, const rx_t* r2) {
31 return (mutt_strcmp (r1->pattern, r2->pattern));
34 int rx_list_match (list2_t* l, const char* pat) {
36 if (!pat || list_empty(l))
38 for (i = 0; i < l->length; i++)
39 if (REGEXEC(((rx_t*) l->data[i])->rx, pat) == 0)
44 int rx_lookup (list2_t* l, const char* pat) {
46 if (!pat || !*pat || list_empty(l))
48 for (i = 0; i < l->length; i++)
49 if (mutt_strcmp (((rx_t*) l->data[i])->pattern, pat) == 0)