]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Make sure mail_index_sync_record() doesn't waste data stack.
authorTimo Sirainen <tss@iki.fi>
Thu, 1 Sep 2011 16:33:22 +0000 (19:33 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 1 Sep 2011 16:33:22 +0000 (19:33 +0300)
src/lib-index/mail-index-sync-update.c
src/lib-index/mail-index-view-sync.c

index 1b4c2066ba9ebf0130166f1b530c6981ff5c28a9..bca5108eec122a6699a96413cf01faf462a23901 100644 (file)
@@ -518,9 +518,10 @@ static int sync_header_update(const struct mail_transaction_header_update *u,
        return 1;
 }
 
-int mail_index_sync_record(struct mail_index_sync_map_ctx *ctx,
-                          const struct mail_transaction_header *hdr,
-                          const void *data)
+static int
+mail_index_sync_record_real(struct mail_index_sync_map_ctx *ctx,
+                           const struct mail_transaction_header *hdr,
+                           const void *data)
 {
        int ret = 0;
 
@@ -813,6 +814,18 @@ int mail_index_sync_record(struct mail_index_sync_map_ctx *ctx,
        return ret;
 }
 
+int mail_index_sync_record(struct mail_index_sync_map_ctx *ctx,
+                          const struct mail_transaction_header *hdr,
+                          const void *data)
+{
+       int ret;
+
+       T_BEGIN {
+               ret = mail_index_sync_record_real(ctx, hdr, data);
+       } T_END;
+       return ret;
+}
+
 void mail_index_sync_map_init(struct mail_index_sync_map_ctx *sync_map_ctx,
                              struct mail_index_view *view,
                              enum mail_index_sync_handler_type type)
@@ -1020,10 +1033,7 @@ int mail_index_sync_map(struct mail_index_map **_map,
                }
 
                /* we'll just skip over broken entries */
-               T_BEGIN {
-                       (void)mail_index_sync_record(&sync_map_ctx,
-                                                    thdr, tdata);
-               } T_END;
+               (void)mail_index_sync_record(&sync_map_ctx, thdr, tdata);
        }
        map = view->map;
 
index 5f5203671a722100ee618ce0432603f545858d51..fb0fd7eeed32aed248419e1702cb9b447f2ed16d 100644 (file)
@@ -736,10 +736,8 @@ mail_index_view_sync_get_next_transaction(struct mail_index_view_sync_ctx *ctx)
        if (ctx->sync_map_update && !synced_to_map) {
                if ((hdr->type & (MAIL_TRANSACTION_EXPUNGE |
                                  MAIL_TRANSACTION_EXPUNGE_GUID)) == 0) {
-                       T_BEGIN {
-                               ret = mail_index_sync_record(&ctx->sync_map_ctx,
-                                                            hdr, ctx->data);
-                       } T_END;
+                       ret = mail_index_sync_record(&ctx->sync_map_ctx,
+                                                    hdr, ctx->data);
                }
                if (ret < 0)
                        return -1;