diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 2008-09-17 22:27:43 +0200 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 2008-09-17 22:27:43 +0200 |
commit | 4af1c6d6e20ec5e803ba760760a3dec46bec04c7 (patch) | |
tree | 7c620fed5048c91bf2e33e945eece8c9e7259a84 /alias.c | |
parent | 3d8a7dcf1851c4e310cfcb37a081dea12ac6aa43 (diff) |
sorting efficiency
Diffstat (limited to 'alias.c')
-rw-r--r-- | alias.c | 41 |
1 files changed, 28 insertions, 13 deletions
@@ -332,6 +332,8 @@ retry_name: return; } + alias_add_reverse (new); + if ((t = Aliases)) { while (t->next) @@ -440,23 +442,36 @@ int mutt_check_alias_name (const char *s, char *dest, size_t destlen) */ ADDRESS *alias_reverse_lookup (ADDRESS *a) { - ALIAS *t = Aliases; - ADDRESS *ap; - if (!a || !a->mailbox) - return NULL; + return NULL; + + return hash_find (ReverseAlias, a->mailbox); +} - for (; t; t = t->next) +void alias_add_reverse (ALIAS *t) +{ + ADDRESS *ap; + if (!t) + return; + + for (ap = t->addr; ap; ap = ap->next) { - /* cycle through all addresses if this is a group alias */ - for (ap = t->addr; ap; ap = ap->next) - { - if (!ap->group && ap->mailbox && - ascii_strcasecmp (ap->mailbox, a->mailbox) == 0) - return ap; - } + if (!ap->group && ap->mailbox) + hash_insert (ReverseAlias, ap->mailbox, ap, 1); + } +} + +void alias_delete_reverse (ALIAS *t) +{ + ADDRESS *ap; + if (!t) + return; + + for (ap = t->addr; ap; ap = ap->next) + { + if (!ap->group && ap->mailbox) + hash_delete (ReverseAlias, ap->mailbox, ap, NULL); } - return 0; } /* alias_complete() -- alias completion routine |