X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=lib%2Frx.c;h=230bf3df0628115022e918ab871add4a01c67c2d;hb=df7c0ef298343ef5523ad0be5af9fd629f901738;hp=c0f6982281dd505bf30751a60b06647a27711194;hpb=ba5e3af4ea19e1d20c80941c077039871ec84258;p=apps%2Fmadmutt.git diff --git a/lib/rx.c b/lib/rx.c index c0f6982..230bf3d 100644 --- a/lib/rx.c +++ b/lib/rx.c @@ -8,16 +8,17 @@ #include "config.h" #endif +#include +#include + #include "rx.h" -#include "mem.h" -#include "str.h" rx_t *rx_compile (const char *s, int flags) { - rx_t *pp = mem_calloc (1, sizeof (rx_t)); + rx_t *pp = p_new(rx_t, 1); - pp->pattern = str_dup (s); - pp->rx = mem_calloc (1, sizeof (regex_t)); + pp->pattern = m_strdup(s); + pp->rx = p_new(regex_t, 1); if (REGCOMP(pp->rx, NONULL (s), flags) != 0) rx_free (&pp); @@ -25,14 +26,14 @@ rx_t *rx_compile (const char *s, int flags) { } void rx_free (rx_t** p) { - mem_free(&(*p)->pattern); + p_delete(&(*p)->pattern); regfree ((*p)->rx); - mem_free(&(*p)->rx); - mem_free(p); + p_delete(&(*p)->rx); + p_delete(p); } int rx_compare (const rx_t* r1, const rx_t* r2) { - return (str_cmp (r1->pattern, r2->pattern)); + return (m_strcmp(r1->pattern, r2->pattern)); } int rx_list_match (list2_t* l, const char* pat) { @@ -50,7 +51,7 @@ int rx_lookup (list2_t* l, const char* pat) { if (!pat || !*pat || list_empty(l)) return (-1); for (i = 0; i < l->length; i++) - if (str_cmp (((rx_t*) l->data[i])->pattern, pat) == 0) + if (m_strcmp(((rx_t*) l->data[i])->pattern, pat) == 0) return (i); return (-1); }