From: Timo Sirainen Date: Mon, 3 Jun 2024 16:47:05 +0000 (+0300) Subject: config: Split off config_dump_full_write_filter() X-Git-Tag: 2.4.1~792 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ab2a9f6791da5d066a932a40634e847647f6883;p=thirdparty%2Fdovecot%2Fcore.git config: Split off config_dump_full_write_filter() --- diff --git a/src/config/config-dump-full.c b/src/config/config-dump-full.c index 9f6dcd9337..702e40caf7 100644 --- a/src/config/config-dump-full.c +++ b/src/config/config-dump-full.c @@ -251,6 +251,19 @@ config_dump_full_stdout_callback(const struct config_export_setting *set, } T_END; } +static void config_dump_full_write_filter(struct dump_context *ctx) +{ + if (ctx->filter_written) + return; + ctx->filter_written = TRUE; + + uint64_t blob_size = UINT64_MAX; + o_stream_nsend(ctx->output, &blob_size, sizeof(blob_size)); + /* Start by assuming there is no error. If there is, the error + handling code path truncates the file and writes the error. */ + o_stream_nsend(ctx->output, "", 1); +} + static void config_dump_full_callback(const struct config_export_setting *set, struct dump_context *ctx) { @@ -266,15 +279,7 @@ static void config_dump_full_callback(const struct config_export_setting *set, return; } - if (!ctx->filter_written) { - uint64_t blob_size = UINT64_MAX; - o_stream_nsend(ctx->output, &blob_size, sizeof(blob_size)); - /* Start by assuming there is no error. If there is, the error - handling code path truncates the file and writes the - error. */ - o_stream_nsend(ctx->output, "", 1); - ctx->filter_written = TRUE; - } + config_dump_full_write_filter(ctx); uint32_t key_be32 = cpu32_to_be(set->key_define_idx); if (ctx->delayed_output != NULL &&