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.
20 LIST *mutt_copy_list (LIST * p) {
21 LIST *t, *r = NULL, *l = NULL;
23 for (; p; p = p->next) {
24 t = (LIST *) mem_malloc (sizeof (LIST));
25 t->data = str_dup (p->data);
38 LIST *mutt_add_list (LIST * head, const char *data) {
39 size_t len = str_len (data);
40 return (mutt_add_list_n (head, data, len ? len + 1 : 0));
43 LIST *mutt_add_list_n (LIST *head, const void *data, size_t len) {
46 for (tmp = head; tmp && tmp->next; tmp = tmp->next);
49 tmp->next = mem_malloc (sizeof (LIST));
52 head = tmp = mem_malloc (sizeof (LIST));
54 tmp->data = mem_malloc (len);
56 memcpy (tmp->data, data, len);
61 void mutt_free_list (LIST ** list) {
68 *list = (*list)->next;