Mercurial > dovecot > original-hg > dovecot-1.2
changeset 8287:944f709797df HEAD
Trash plugin: Small optimization.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 18 Oct 2008 15:26:41 +0300 |
parents | f21c6ade6e7f |
children | 5e79a333954d |
files | src/plugins/trash/trash-plugin.c |
diffstat | 1 files changed, 8 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/trash/trash-plugin.c Sat Oct 18 14:54:06 2008 +0300 +++ b/src/plugins/trash/trash-plugin.c Sat Oct 18 15:26:41 2008 +0300 @@ -20,9 +20,9 @@ const char *name; int priority; /* lower number = higher priority */ + struct mail_storage *storage; + /* temporarily set while cleaning: */ - const char *ns_name; - struct mail_storage *storage; struct mailbox *box; struct mailbox_transaction_context *trans; struct mail_search_context *search_ctx; @@ -44,7 +44,7 @@ { struct mail_search_args *search_args; - trash->box = mailbox_open(trash->storage, trash->ns_name, NULL, + trash->box = mailbox_open(trash->storage, trash->name, NULL, MAILBOX_OPEN_KEEP_RECENT); if (trash->box == NULL) return 0; @@ -93,12 +93,14 @@ { struct mail_storage *const *storages; unsigned int i, count; + const char *name; storages = array_get("a->storages, &count); for (i = 0; i < count; i++) { - trash->ns_name = trash->name; - if (mail_namespace_update_name(storages[i]->ns, - &trash->ns_name)) { + name = trash->name; + if (mail_namespace_update_name(storages[i]->ns, &name)) { + if (name != trash->name) + trash->name = p_strdup(config_pool, name); trash->storage = storages[i]; return; } @@ -179,8 +181,6 @@ } mailbox_close(&trash->box); - trash->storage = NULL; - trash->ns_name = NULL; } if (size_expunged < size_needed) {