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>
22 LIST *mutt_copy_list (LIST * p) {
23 LIST *t, *r = NULL, *l = NULL;
25 for (; p; p = p->next) {
27 t->data = str_dup (p->data);
40 LIST *mutt_add_list (LIST * head, const char *data) {
41 size_t len = str_len (data);
42 return (mutt_add_list_n (head, data, len ? len + 1 : 0));
45 LIST *mutt_add_list_n (LIST *head, const void *data, size_t len) {
48 for (tmp = head; tmp && tmp->next; tmp = tmp->next);
51 tmp->next = p_new(LIST, 1);
54 head = tmp = p_new(LIST, 1);
56 tmp->data = p_new(char, len);
58 memcpy (tmp->data, data, len);
63 void mutt_free_list (LIST ** list) {
70 *list = (*list)->next;