X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=list.c;h=54218b945bbf6bb1a988deef0122f5afbed588eb;hp=eee8a4f1b2655cb8373732483d8c90e8a42b5951;hb=ecaab35b973fbceb58b5ed174971c82762cc0199;hpb=0e654d058aa2b5027166bd3e535f85bbc4f214dc diff --git a/list.c b/list.c index eee8a4f..54218b9 100644 --- a/list.c +++ b/list.c @@ -13,16 +13,17 @@ #include #include +#include +#include + #include "list.h" -#include "lib/mem.h" -#include "lib/str.h" LIST *mutt_copy_list (LIST * p) { LIST *t, *r = NULL, *l = NULL; for (; p; p = p->next) { - t = (LIST *) mem_malloc (sizeof (LIST)); - t->data = str_dup (p->data); + t = p_new(LIST, 1); + t->data = m_strdup(p->data); t->next = NULL; if (l) { r->next = t; @@ -36,7 +37,7 @@ LIST *mutt_copy_list (LIST * p) { LIST *mutt_add_list (LIST * head, const char *data) { - size_t len = str_len (data); + size_t len = m_strlen(data); return (mutt_add_list_n (head, data, len ? len + 1 : 0)); } @@ -46,12 +47,12 @@ LIST *mutt_add_list_n (LIST *head, const void *data, size_t len) { for (tmp = head; tmp && tmp->next; tmp = tmp->next); if (tmp) { - tmp->next = mem_malloc (sizeof (LIST)); + tmp->next = p_new(LIST, 1); tmp = tmp->next; } else - head = tmp = mem_malloc (sizeof (LIST)); + head = tmp = p_new(LIST, 1); - tmp->data = mem_malloc (len); + tmp->data = p_new(char, len); if (len) memcpy (tmp->data, data, len); tmp->next = NULL; @@ -66,7 +67,7 @@ void mutt_free_list (LIST ** list) { while (*list) { p = *list; *list = (*list)->next; - mem_free (&p->data); - mem_free (&p); + p_delete(&p->data); + p_delete(&p); } }