Esempio n. 1
0
struct mail_index_view *
mail_index_view_dup_private(const struct mail_index_view *src)
{
	struct mail_index_view *view;
	struct mail_index_map *map;

	view = i_new(struct mail_index_view, 1);
	mail_index_view_clone(view, src);

	map = mail_index_map_clone(view->map);
	mail_index_unmap(&view->map);
	view->map = map;
	return view;
}
Esempio n. 2
0
void mail_index_view_unref_maps(struct mail_index_view *view)
{
	struct mail_index_map **maps;
	unsigned int i, count;

	if (!array_is_created(&view->map_refs))
		return;

	maps = array_get_modifiable(&view->map_refs, &count);
	for (i = 0; i < count; i++)
		mail_index_unmap(&maps[i]);

	array_clear(&view->map_refs);
}
Esempio n. 3
0
static void view_close(struct mail_index_view *view)
{
	i_assert(view->refcount == 0);
	i_assert(view->index->views != NULL);

	DLLIST_REMOVE(&view->index->views, view);

	mail_transaction_log_view_close(&view->log_view);

	if (array_is_created(&view->syncs_hidden))
		array_free(&view->syncs_hidden);
	mail_index_unmap(&view->map);
	if (array_is_created(&view->map_refs)) {
		mail_index_view_unref_maps(view);
		array_free(&view->map_refs);
	}
	array_free(&view->module_contexts);
	i_free(view);
}
Esempio n. 4
0
static void tview_close(struct mail_index_view *view)
{
	struct mail_index_view_transaction *tview =
		(struct mail_index_view_transaction *)view;
	struct mail_index_transaction *t = tview->t;
	void **recs;
	unsigned int i, count;

	if (tview->lookup_map != NULL)
		mail_index_unmap(&tview->lookup_map);
	buffer_free(&tview->lookup_return_data);

	if (array_is_created(&tview->all_recs)) {
		recs = array_get_modifiable(&tview->all_recs, &count);
		for (i = 0; i < count; i++)
			i_free(recs[i]);
		array_free(&tview->all_recs);
	}

	tview->super->close(view);
	mail_index_transaction_unref(&t);
}