-
-/* given a list of addresses, return a list of unique addresses */
-address_t *mutt_remove_duplicates (address_t * addr)
-{
- address_t *top = addr;
- address_t **last = ⊤
- address_t *tmp;
- int dodup = 0;
-
- while (addr) {
- for (tmp = top; tmp && tmp != addr; tmp = tmp->next) {
- if (tmp->mailbox && addr->mailbox &&
- !ascii_strcasecmp (addr->mailbox, tmp->mailbox)) {
- dodup = 1;
- break;
- }
- }
-
- if (dodup) {
- *last = addr->next;
-
- addr->next = NULL;
- address_list_wipe(&addr);
-
- addr = *last;
- }
- else {
- last = &addr->next;
- addr = addr->next;
- }
- }
-
- return (top);
-}
-