mailbox-list-index-sync.c (dovecot-2.3.16) | : | mailbox-list-index-sync.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 160 | skipping to change at line 160 | |||
{ | { | |||
struct mailbox_list_index *ilist = ctx->ilist; | struct mailbox_list_index *ilist = ctx->ilist; | |||
ARRAY_TYPE(uint32_t) existing_name_ids; | ARRAY_TYPE(uint32_t) existing_name_ids; | |||
buffer_t *hdr_buf; | buffer_t *hdr_buf; | |||
const void *ext_data; | const void *ext_data; | |||
size_t ext_size; | size_t ext_size; | |||
const char *name; | const char *name; | |||
uint32_t id, prev_id = 0; | uint32_t id, prev_id = 0; | |||
/* get all existing name IDs sorted */ | /* get all existing name IDs sorted */ | |||
t_array_init(&existing_name_ids, 64); | i_array_init(&existing_name_ids, 64); | |||
get_existing_name_ids(&existing_name_ids, ilist->mailbox_tree); | get_existing_name_ids(&existing_name_ids, ilist->mailbox_tree); | |||
array_sort(&existing_name_ids, uint32_cmp); | array_sort(&existing_name_ids, uint32_cmp); | |||
hdr_buf = t_buffer_create(1024); | hdr_buf = buffer_create_dynamic(default_pool, 1024); | |||
buffer_append_zero(hdr_buf, sizeof(struct mailbox_list_index_header)); | buffer_append_zero(hdr_buf, sizeof(struct mailbox_list_index_header)); | |||
/* add existing names to header (with deduplication) */ | /* add existing names to header (with deduplication) */ | |||
array_foreach_elem(&existing_name_ids, id) { | array_foreach_elem(&existing_name_ids, id) { | |||
if (id != prev_id) { | if (id != prev_id) { | |||
buffer_append(hdr_buf, &id, sizeof(id)); | buffer_append(hdr_buf, &id, sizeof(id)); | |||
name = hash_table_lookup(ilist->mailbox_names, | name = hash_table_lookup(ilist->mailbox_names, | |||
POINTER_CAST(id)); | POINTER_CAST(id)); | |||
i_assert(name != NULL); | i_assert(name != NULL); | |||
buffer_append(hdr_buf, name, strlen(name) + 1); | buffer_append(hdr_buf, name, strlen(name) + 1); | |||
skipping to change at line 191 | skipping to change at line 191 | |||
mail_index_get_header_ext(ctx->view, ilist->ext_id, | mail_index_get_header_ext(ctx->view, ilist->ext_id, | |||
&ext_data, &ext_size); | &ext_data, &ext_size); | |||
if (nearest_power(ext_size) != nearest_power(hdr_buf->used)) { | if (nearest_power(ext_size) != nearest_power(hdr_buf->used)) { | |||
mail_index_ext_resize(ctx->trans, ilist->ext_id, | mail_index_ext_resize(ctx->trans, ilist->ext_id, | |||
nearest_power(hdr_buf->used), | nearest_power(hdr_buf->used), | |||
sizeof(struct mailbox_list_index_record), | sizeof(struct mailbox_list_index_record), | |||
sizeof(uint32_t)); | sizeof(uint32_t)); | |||
} | } | |||
mail_index_update_header_ext(ctx->trans, ilist->ext_id, | mail_index_update_header_ext(ctx->trans, ilist->ext_id, | |||
0, hdr_buf->data, hdr_buf->used); | 0, hdr_buf->data, hdr_buf->used); | |||
buffer_free(&hdr_buf); | ||||
array_free(&existing_name_ids); | ||||
} | } | |||
static void | static void | |||
mailbox_list_index_node_clear_exists(struct mailbox_list_index_node *node) | mailbox_list_index_node_clear_exists(struct mailbox_list_index_node *node) | |||
{ | { | |||
while (node != NULL) { | while (node != NULL) { | |||
if (node->children != NULL) | if (node->children != NULL) | |||
mailbox_list_index_node_clear_exists(node->children); | mailbox_list_index_node_clear_exists(node->children); | |||
node->flags &= ENUM_NEGATE(MAILBOX_LIST_INDEX_FLAG_SYNC_EXISTS); | node->flags &= ENUM_NEGATE(MAILBOX_LIST_INDEX_FLAG_SYNC_EXISTS); | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 4 lines changed or added |