X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=lib%2Frx.c;fp=lib%2Frx.c;h=0000000000000000000000000000000000000000;hb=03fe827a7d4a7ad79ac235654414aa339a9a2c9a;hp=230bf3df0628115022e918ab871add4a01c67c2d;hpb=05a3bbbe420e4afc76e0eea24ce32f859405dc4a;p=apps%2Fmadmutt.git diff --git a/lib/rx.c b/lib/rx.c deleted file mode 100644 index 230bf3d..0000000 --- a/lib/rx.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * This file is part of mutt-ng, see http://www.muttng.org/. - * It's licensed under the GNU General Public License, - * please see the file GPL in the top level source directory. - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -#include "rx.h" - - -rx_t *rx_compile (const char *s, int flags) { - rx_t *pp = p_new(rx_t, 1); - - pp->pattern = m_strdup(s); - pp->rx = p_new(regex_t, 1); - if (REGCOMP(pp->rx, NONULL (s), flags) != 0) - rx_free (&pp); - - return pp; -} - -void rx_free (rx_t** p) { - p_delete(&(*p)->pattern); - regfree ((*p)->rx); - p_delete(&(*p)->rx); - p_delete(p); -} - -int rx_compare (const rx_t* r1, const rx_t* r2) { - return (m_strcmp(r1->pattern, r2->pattern)); -} - -int rx_list_match (list2_t* l, const char* pat) { - int i = 0; - if (!pat || !*pat || list_empty(l)) - return (0); - for (i = 0; i < l->length; i++) - if (REGEXEC(((rx_t*) l->data[i])->rx, pat) == 0) - return (1); - return (0); -} - -int rx_lookup (list2_t* l, const char* pat) { - int i = 0; - if (!pat || !*pat || list_empty(l)) - return (-1); - for (i = 0; i < l->length; i++) - if (m_strcmp(((rx_t*) l->data[i])->pattern, pat) == 0) - return (i); - return (-1); -}