2 * Copyright notice from original mutt:
3 * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
5 * This file is part of mutt-ng, see http://www.muttng.org/.
6 * It's licensed under the GNU General Public License,
7 * please see the file GPL in the top level source directory.
16 #include <lib-lib/mem.h>
21 LIST *mutt_copy_list (LIST * p) {
22 LIST *t, *r = NULL, *l = NULL;
24 for (; p; p = p->next) {
26 t->data = str_dup (p->data);
39 LIST *mutt_add_list (LIST * head, const char *data) {
40 size_t len = str_len (data);
41 return (mutt_add_list_n (head, data, len ? len + 1 : 0));
44 LIST *mutt_add_list_n (LIST *head, const void *data, size_t len) {
47 for (tmp = head; tmp && tmp->next; tmp = tmp->next);
50 tmp->next = p_new(LIST, 1);
53 head = tmp = p_new(LIST, 1);
55 tmp->data = p_new(char, len);
57 memcpy (tmp->data, data, len);
62 void mutt_free_list (LIST ** list) {
69 *list = (*list)->next;