struct local_dsync_worker_mailbox_iter {
struct dsync_worker_mailbox_iter iter;
+ pool_t ret_pool;
struct mailbox_list_iterate_context *list_iter;
struct hash_iterate_context *deleted_iter;
struct hash_iterate_context *deleted_dir_iter;
iter = i_new(struct local_dsync_worker_mailbox_iter, 1);
iter->iter.worker = _worker;
+ iter->ret_pool = pool_alloconly_create("local mailbox iter", 1024);
iter->list_iter =
mailbox_list_iter_init_namespaces(worker->user->namespaces,
patterns, list_flags);
dsync_box_r->uid_next = status.uidnext;
dsync_box_r->highest_modseq = status.highest_modseq;
+ p_clear(iter->ret_pool);
fields = array_get(status.cache_fields, &field_count);
- t_array_init(&dsync_box_r->cache_fields, field_count);
+ p_array_init(&dsync_box_r->cache_fields, iter->ret_pool, field_count);
for (i = 0; i < field_count; i++) {
- const char *field_name = t_strdup(fields[i]);
+ const char *field_name = p_strdup(iter->ret_pool, fields[i]);
+
array_append(&dsync_box_r->cache_fields, &field_name, 1);
}
if (mailbox_list_iter_deinit(&iter->list_iter) < 0)
ret = -1;
+ pool_unref(&iter->ret_pool);
i_free(iter);
return ret;
}
int dsync_worker_mailbox_iter_next(struct dsync_worker_mailbox_iter *iter,
struct dsync_mailbox *dsync_box_r)
{
- return iter->worker->v.mailbox_iter_next(iter, dsync_box_r);
+ int ret;
+
+ T_BEGIN {
+ ret = iter->worker->v.mailbox_iter_next(iter, dsync_box_r);
+ } T_END;
+ return ret;
}
int dsync_worker_mailbox_iter_deinit(struct dsync_worker_mailbox_iter **_iter)
i_assert(dsync_box->uid_validity != 0 ||
dsync_mailbox_is_noselect(dsync_box));
- if (!worker->readonly)
+ if (!worker->readonly) T_BEGIN {
worker->v.create_mailbox(worker, dsync_box);
+ } T_END;
}
void dsync_worker_delete_mailbox(struct dsync_worker *worker,
const struct dsync_mailbox *dsync_box)
{
- if (!worker->readonly)
+ if (!worker->readonly) T_BEGIN {
worker->v.delete_mailbox(worker, dsync_box);
+ } T_END;
}
void dsync_worker_rename_mailbox(struct dsync_worker *worker,
const mailbox_guid_t *mailbox,
const struct dsync_mailbox *dsync_box)
{
- if (!worker->readonly)
+ if (!worker->readonly) T_BEGIN {
worker->v.rename_mailbox(worker, mailbox, dsync_box);
+ } T_END;
}
void dsync_worker_update_mailbox(struct dsync_worker *worker,
void dsync_worker_select_mailbox(struct dsync_worker *worker,
const struct dsync_mailbox *box)
{
- worker->v.select_mailbox(worker, &box->mailbox_guid,
- &box->cache_fields);
+ T_BEGIN {
+ worker->v.select_mailbox(worker, &box->mailbox_guid,
+ &box->cache_fields);
+ } T_END;
}
void dsync_worker_msg_update_metadata(struct dsync_worker *worker,
void *context)
{
if (!worker->failed && !worker->readonly) {
- worker->v.msg_copy(worker, src_mailbox, src_uid, dest_msg,
- callback, context);
+ T_BEGIN {
+ worker->v.msg_copy(worker, src_mailbox, src_uid,
+ dest_msg, callback, context);
+ } T_END;
} else {
callback(FALSE, context);
}
const struct dsync_msg_static_data *data)
{
if (!worker->readonly) {
- if (!worker->failed)
+ if (!worker->failed) T_BEGIN {
worker->v.msg_save(worker, msg, data);
+ } T_END;
} else {
const unsigned char *d;
size_t size;
{
i_assert(uid != 0);
- if (!worker->failed)
- worker->v.msg_get(worker, mailbox, uid, callback, context);
- else
+ if (worker->failed)
callback(DSYNC_MSG_GET_RESULT_FAILED, NULL, context);
+ else T_BEGIN {
+ worker->v.msg_get(worker, mailbox, uid, callback, context);
+ } T_END;
}
void dsync_worker_finish(struct dsync_worker *worker,
int ret;
memset(changes_r, 0, sizeof(*changes_r));
- changes_r->pool = pool_alloconly_create("transaction changes", 1024);
+ changes_r->pool = pool_alloconly_create(MEMPOOL_GROWING
+ "transaction changes", 512);
p_array_init(&changes_r->saved_uids, changes_r->pool, 32);
_t->changes = changes_r;
struct mail_transaction_commit_changes *changes_r)
{
struct mailbox_transaction_context *t = *_t;
+ int ret;
t->box->transaction_count--;
*_t = NULL;
- return t->box->v.transaction_commit(t, changes_r);
+ T_BEGIN {
+ ret = t->box->v.transaction_commit(t, changes_r);
+ } T_END;
+ return ret;
}
void mailbox_transaction_rollback(struct mailbox_transaction_context **_t)
bool mailbox_list_is_valid_pattern(struct mailbox_list *list,
const char *pattern)
{
- return list->v.is_valid_pattern(list, pattern);
+ bool ret;
+
+ T_BEGIN {
+ ret = list->v.is_valid_pattern(list, pattern);
+ } T_END;
+ return ret;
}
bool mailbox_list_is_valid_existing_name(struct mailbox_list *list,
const char *name)
{
+ bool ret;
+
if (*name == '\0' && *list->ns->prefix != '\0') {
/* an ugly way to get to mailbox root (e.g. Maildir/ when
it's not the INBOX) */
return TRUE;
}
- return list->v.is_valid_existing_name(list, name);
+ T_BEGIN {
+ ret = list->v.is_valid_existing_name(list, name);
+ } T_END;
+ return ret;
}
bool mailbox_list_is_valid_create_name(struct mailbox_list *list,
i_assert(namespaces != NULL);
- pool = pool_alloconly_create("mailbox list namespaces", 512);
+ pool = pool_alloconly_create("mailbox list namespaces", 1024);
ctx = p_new(pool, struct ns_list_iterate_context, 1);
ctx->pool = pool;
ctx->ctx.flags = flags;