projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix compilation warnings in compose.c and init.c
[apps/madmutt.git]
/
lib-lib
/
list.c
diff --git
a/lib-lib/list.c
b/lib-lib/list.c
index
74c60c7
..
83123a5
100644
(file)
--- a/
lib-lib/list.c
+++ b/
lib-lib/list.c
@@
-29,33
+29,30
@@
#include "str.h"
#include "list.h"
#include "str.h"
#include "list.h"
-LIST *mutt_copy_list(LIST *p) {
- LIST *t, *r = NULL, *l = NULL;
+string_list_t *string_list_dup(const string_list_t *p) {
+ string_list_t *res = NULL;
+ string_list_t **last = &res;
for (; p; p = p->next) {
for (; p; p = p->next) {
- t = p_new(LIST, 1);
- t->data = m_strdup(p->data);
- t->next = NULL;
- if (l) {
- r->next = t;
- r = r->next;
- } else {
- l = r = t;
- }
+ *last = string_item_new();
+ (*last)->data = m_strdup(p->data);
+ last = &(*last)->next;
}
}
- return l;
+
+ return res;
}
}
-LIST *mutt_add_list_n(LIST *head, const void *data, size_t len) {
- LIST *tmp;
+/* FIXME: b0rken API's, replace that at any cost */
+string_list_t *mutt_add_list_n(string_list_t *head, const void *data, size_t len) {
+ string_list_t *tmp;
for (tmp = head; tmp && tmp->next; tmp = tmp->next);
if (tmp) {
for (tmp = head; tmp && tmp->next; tmp = tmp->next);
if (tmp) {
- tmp->next = p_new(
LIST
, 1);
+ tmp->next = p_new(
string_list_t
, 1);
tmp = tmp->next;
} else {
tmp = tmp->next;
} else {
- head = tmp = p_new(
LIST
, 1);
+ head = tmp = p_new(
string_list_t
, 1);
}
tmp->data = p_dup((const char *)data, len);
}
tmp->data = p_dup((const char *)data, len);
@@
-63,15
+60,3
@@
LIST *mutt_add_list_n(LIST *head, const void *data, size_t len) {
return head;
}
return head;
}
-void mutt_free_list(LIST **list) {
- LIST *p;
-
- if (list) {
- while (*list) {
- p = *list;
- *list = (*list)->next;
- p_delete(&p->data);
- p_delete(&p);
- }
- }
-}