]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Remove extension record sync handlers
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sun, 29 Apr 2018 09:23:49 +0000 (12:23 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 30 Apr 2018 12:46:57 +0000 (15:46 +0300)
This is no longer used by anything, and it makes the fix in the following
commit much easier.

This was originally added in 6a19e109ee8c5a6f688da83a86a7f6abeb71abdd to
allow dovecot.index.cache updating to hook into updating cache offsets to
link cache records together. This was reimplemented in a different way in
131b073bdc3650083b00616dc778dd3017c2bbb5

src/lib-index/mail-index-private.h
src/lib-index/mail-index-sync-ext.c
src/lib-index/mail-index.c

index 4350b1cfe54345d2de90330bd03380c74f14fcde..f7ac82c47ab20ed01a62342d95a14c0556ffc43d 100644 (file)
@@ -45,9 +45,6 @@ struct mail_index_sync_map_ctx;
 typedef int mail_index_expunge_handler_t(struct mail_index_sync_map_ctx *ctx,
                                         uint32_t seq, const void *data,
                                         void **sync_context, void *context);
-typedef int mail_index_sync_handler_t(struct mail_index_sync_map_ctx *ctx,
-                                     uint32_t seq, void *old_data,
-                                     const void *new_data, void **context);
 typedef void mail_index_sync_lost_handler_t(struct mail_index *index);
 
 #define MAIL_INDEX_HEADER_SIZE_ALIGN(size) \
@@ -93,11 +90,6 @@ enum mail_index_sync_handler_type {
        MAIL_INDEX_SYNC_HANDLER_VIEW    = 0x04
 };
 
-struct mail_index_sync_handler {
-       mail_index_sync_handler_t *callback;
-        enum mail_index_sync_handler_type type;
-};
-
 struct mail_index_registered_ext {
        const char *name;
        uint32_t index_idx; /* index ext_id */
@@ -105,7 +97,6 @@ struct mail_index_registered_ext {
        uint16_t record_size;
        uint16_t record_align;
 
-       struct mail_index_sync_handler sync_handler;
        mail_index_expunge_handler_t *expunge_handler;
 
        void *expunge_context;
@@ -245,11 +236,6 @@ void mail_index_register_expunge_handler(struct mail_index *index,
                                         void *context);
 void mail_index_unregister_expunge_handler(struct mail_index *index,
                                           uint32_t ext_id);
-void mail_index_register_sync_handler(struct mail_index *index, uint32_t ext_id,
-                                     mail_index_sync_handler_t *cb,
-                                     enum mail_index_sync_handler_type type);
-void mail_index_unregister_sync_handler(struct mail_index *index,
-                                       uint32_t ext_id);
 void mail_index_register_sync_lost_handler(struct mail_index *index,
                                           mail_index_sync_lost_handler_t *cb);
 void mail_index_unregister_sync_lost_handler(struct mail_index *index,
index 456efaee0bc21fa1b02287c6dfa5deb40ad62cec..1696b6d2500e118071d9a0b350acb98a96b96c12 100644 (file)
@@ -94,26 +94,8 @@ void mail_index_sync_init_handlers(struct mail_index_sync_map_ctx *ctx)
 
 void mail_index_sync_deinit_handlers(struct mail_index_sync_map_ctx *ctx)
 {
-       const struct mail_index_registered_ext *rext;
-       void **extra_contexts;
-       unsigned int i, rext_count, context_count;
-
-       if (!array_is_created(&ctx->extra_contexts))
-               return;
-
-       rext = array_get(&ctx->view->index->extensions, &rext_count);
-       extra_contexts =
-               array_get_modifiable(&ctx->extra_contexts, &context_count);
-       i_assert(context_count <= rext_count);
-
-       for (i = 0; i < context_count; i++) {
-               if (extra_contexts[i] != NULL) {
-                       rext[i].sync_handler.callback(ctx, 0, NULL, NULL,
-                                                     &extra_contexts[i]);
-               }
-       }
-
-       array_free(&ctx->extra_contexts);
+       if (array_is_created(&ctx->extra_contexts))
+               array_free(&ctx->extra_contexts);
 }
 
 static struct mail_index_ext_header *
@@ -660,10 +642,8 @@ mail_index_sync_ext_rec_update(struct mail_index_sync_map_ctx *ctx,
        struct mail_index_view *view = ctx->view;
        struct mail_index_record *rec;
        const struct mail_index_ext *ext;
-       const struct mail_index_registered_ext *rext;
        void *old_data;
        uint32_t seq;
-       int ret;
 
        i_assert(ctx->cur_ext_map_idx != (uint32_t)-1);
        i_assert(!ctx->cur_ext_ignore);
@@ -684,20 +664,6 @@ mail_index_sync_ext_rec_update(struct mail_index_sync_map_ctx *ctx,
        rec = MAIL_INDEX_REC_AT_SEQ(view->map, seq);
        old_data = PTR_OFFSET(rec, ext->record_offset);
 
-       rext = array_idx(&view->index->extensions, ext->index_idx);
-
-       /* call sync handlers only when its registered type matches with
-          current synchronization type (index/view) */
-       if ((rext->sync_handler.type & ctx->type) != 0) {
-               void **extra_context =
-                       array_idx_modifiable(&ctx->extra_contexts,
-                                            ext->index_idx);
-               ret = rext->sync_handler.callback(ctx, seq, old_data, u + 1,
-                                                 extra_context);
-               if (ret <= 0)
-                       return ret;
-       }
-
        /* @UNSAFE */
        memcpy(old_data, u + 1, ctx->cur_ext_record_size);
        if (ctx->cur_ext_record_size < ext->record_size) {
index 7b6b98f9c5b0108c221b1955ca9a12a04bbedee2..bde6fb1b867896c4e6757ca8ade76a46084420b6 100644 (file)
@@ -330,31 +330,6 @@ void mail_index_unregister_expunge_handler(struct mail_index *index,
        rext->expunge_handler = NULL;
 }
 
-void mail_index_register_sync_handler(struct mail_index *index, uint32_t ext_id,
-                                     mail_index_sync_handler_t *cb,
-                                     enum mail_index_sync_handler_type type)
-{
-       struct mail_index_registered_ext *rext;
-
-       rext = array_idx_modifiable(&index->extensions, ext_id);
-       i_assert(rext->sync_handler.callback == NULL);
-
-       rext->sync_handler.callback = cb;
-       rext->sync_handler.type = type;
-}
-
-void mail_index_unregister_sync_handler(struct mail_index *index,
-                                       uint32_t ext_id)
-{
-       struct mail_index_registered_ext *rext;
-
-       rext = array_idx_modifiable(&index->extensions, ext_id);
-       i_assert(rext->sync_handler.callback != NULL);
-
-       rext->sync_handler.callback = NULL;
-       rext->sync_handler.type = 0;
-}
-
 void mail_index_register_sync_lost_handler(struct mail_index *index,
                                           mail_index_sync_lost_handler_t *cb)
 {