Commit afce403c afce403c36eab3eecab4db52c92e87395d86ee1e by Sergey Poznyakoff

Bugfixes.

* mailbox/listlist.c (mu_list_append_list)
(mu_list_prepend_list): Initialize head.next and head.prev
if the destination list was empty.
* mailbox/freeitem.c: Include stdlib.h.
* mailbox/list.c: Minor style fix.
1 parent 9f2f2247
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
19 #ifdef HAVE_CONFIG_H 19 #ifdef HAVE_CONFIG_H
20 # include <config.h> 20 # include <config.h>
21 #endif 21 #endif
22 #include <stdlib.h>
22 23
23 /* Default destroy_item function. */ 24 /* Default destroy_item function. */
24 void 25 void
......
...@@ -359,7 +359,7 @@ mu_list_do (mu_list_t list, mu_list_action_t *action, void *cbdata) ...@@ -359,7 +359,7 @@ mu_list_do (mu_list_t list, mu_list_action_t *action, void *cbdata)
359 359
360 if (list == NULL || action == NULL) 360 if (list == NULL || action == NULL)
361 return EINVAL; 361 return EINVAL;
362 status = mu_list_get_iterator(list, &itr); 362 status = mu_list_get_iterator (list, &itr);
363 if (status) 363 if (status)
364 return status; 364 return status;
365 for (mu_iterator_first (itr); !mu_iterator_is_done (itr); 365 for (mu_iterator_first (itr); !mu_iterator_is_done (itr);
......
...@@ -107,6 +107,7 @@ mu_list_append_list (mu_list_t list, mu_list_t new_list) ...@@ -107,6 +107,7 @@ mu_list_append_list (mu_list_t list, mu_list_t new_list)
107 if (list->count == 0) 107 if (list->count == 0)
108 { 108 {
109 list->head = new_list->head; 109 list->head = new_list->head;
110 list->head.next->prev = list->head.prev->next = &list->head;
110 list->count = new_list->count; 111 list->count = new_list->count;
111 } 112 }
112 else 113 else
...@@ -123,6 +124,7 @@ mu_list_prepend_list (mu_list_t list, mu_list_t new_list) ...@@ -123,6 +124,7 @@ mu_list_prepend_list (mu_list_t list, mu_list_t new_list)
123 if (list->count == 0) 124 if (list->count == 0)
124 { 125 {
125 list->head = new_list->head; 126 list->head = new_list->head;
127 list->head.next->prev = list->head.prev->next = &list->head;
126 list->count = new_list->count; 128 list->count = new_list->count;
127 } 129 }
128 else 130 else
......