From a12765b92de237e00cea92860c2102bb3ff3010a Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 25 Aug 2025 12:51:05 +0300 Subject: [PATCH] global: Use doveadm_print_empty() --- src/doveadm/doveadm-log.c | 2 +- src/doveadm/doveadm-mail-mailbox-cache.c | 2 +- src/doveadm/doveadm-mail-mailbox-metadata.c | 2 +- src/doveadm/doveadm-master.c | 3 +-- src/doveadm/doveadm-who.c | 3 +-- src/plugins/acl/doveadm-acl.c | 2 +- src/plugins/mail-crypt/doveadm-mail-crypt.c | 4 ++-- 7 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/doveadm/doveadm-log.c b/src/doveadm/doveadm-log.c index 1b1d39d115..124af99111 100644 --- a/src/doveadm/doveadm-log.c +++ b/src/doveadm/doveadm-log.c @@ -366,7 +366,7 @@ static void cmd_log_error_write(const struct log_error *error) doveadm_print(t_strdup_printf("%s.%06u", ts_secs, (unsigned int)error->timestamp.tv_usec)); if (error->prefix[0] == '\0') - doveadm_print(""); + doveadm_print_empty(1); else { const char *prefix = t_strconcat( t_cmd_log_error_trim(error->prefix), ": ", NULL); diff --git a/src/doveadm/doveadm-mail-mailbox-cache.c b/src/doveadm/doveadm-mail-mailbox-cache.c index 7cef0a4f99..40b6aa2dba 100644 --- a/src/doveadm/doveadm-mail-mailbox-cache.c +++ b/src/doveadm/doveadm-mail-mailbox-cache.c @@ -146,7 +146,7 @@ cmd_mailbox_cache_decision_run_per_field(struct mailbox_cache_cmd_context *ctx, *field_name); if (idx == UINT_MAX) { doveadm_print(""); - doveadm_print(""); + doveadm_print_empty(1); continue; } diff --git a/src/doveadm/doveadm-mail-mailbox-metadata.c b/src/doveadm/doveadm-mail-mailbox-metadata.c index c97be854e1..a6faef8b0b 100644 --- a/src/doveadm/doveadm-mail-mailbox-metadata.c +++ b/src/doveadm/doveadm-mail-mailbox-metadata.c @@ -244,7 +244,7 @@ cmd_mailbox_metadata_get_run(struct doveadm_mail_cmd_context *_ctx, doveadm_mail_failed_mailbox(_ctx, box); } else if (ret == 0) { /* not found, print as empty */ - doveadm_print(""); + doveadm_print_empty(1); } else if (value.value_stream != NULL) { if (doveadm_print_istream(value.value_stream) < 0) { e_error(ctx->ctx.cctx->event, "read(%s) failed: %s", diff --git a/src/doveadm/doveadm-master.c b/src/doveadm/doveadm-master.c index d7674979fe..7cac68b36a 100644 --- a/src/doveadm/doveadm-master.c +++ b/src/doveadm/doveadm-master.c @@ -211,8 +211,7 @@ static void cmd_service_status(struct doveadm_cmd_context *cctx) unsigned int i; for (i = 0; i < fields_count && args[i] != NULL; i++) doveadm_print(args[i]); - for (; i < fields_count; i++) - doveadm_print(""); + doveadm_print_empty(fields_count - i); } } T_END; } diff --git a/src/doveadm/doveadm-who.c b/src/doveadm/doveadm-who.c index 2aae5ed684..ec768d7e7d 100644 --- a/src/doveadm/doveadm-who.c +++ b/src/doveadm/doveadm-who.c @@ -452,8 +452,7 @@ who_print_line(struct who_context *ctx, struct doveadm_who_iter *iter, for (alt_idx = 0; line->alt_usernames[alt_idx] != NULL; alt_idx++) doveadm_print(line->alt_usernames[alt_idx]); - for (; alt_idx < iter->alt_username_fields_count; alt_idx++) - doveadm_print(""); + doveadm_print_empty(iter->alt_username_fields_count - alt_idx); } static void cmd_who(struct doveadm_cmd_context *cctx) diff --git a/src/plugins/acl/doveadm-acl.c b/src/plugins/acl/doveadm-acl.c index 25f6350485..a99aad722a 100644 --- a/src/plugins/acl/doveadm-acl.c +++ b/src/plugins/acl/doveadm-acl.c @@ -62,7 +62,7 @@ static void cmd_acl_get_right(const struct acl_rights *rights) if (rights->global) doveadm_print("global"); else - doveadm_print(""); + doveadm_print_empty(1); str = t_str_new(256); if (rights->rights != NULL) diff --git a/src/plugins/mail-crypt/doveadm-mail-crypt.c b/src/plugins/mail-crypt/doveadm-mail-crypt.c index ea4fc2e35e..66bfe9d6eb 100644 --- a/src/plugins/mail-crypt/doveadm-mail-crypt.c +++ b/src/plugins/mail-crypt/doveadm-mail-crypt.c @@ -690,13 +690,13 @@ static void cmd_mcp_key_export_cb(const struct generated_key *key, if (ret == 0) error = "key not found"; doveadm_print(t_strdup_printf("ERROR: %s", error)); - doveadm_print(""); + doveadm_print_empty(1); } else { string_t *out = t_str_new(64); if (!dcrypt_key_store_private(pkey, DCRYPT_FORMAT_PEM, NULL, out, NULL, NULL, &error)) { doveadm_print(t_strdup_printf("ERROR: %s", error)); - doveadm_print(""); + doveadm_print_empty(1); } else { /* this is to make it more compatible with openssl cli as it expects BEGIN on its own line */ -- 2.47.3