From: Timo Sirainen Date: Wed, 24 Oct 2012 07:14:17 +0000 (+0300) Subject: Use imap_append_astring() instead of imap_append_string() where possible. X-Git-Tag: 2.2.alpha1~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44f93baa7b8dca7d00bf187cd3db1c15eed384d2;p=thirdparty%2Fdovecot%2Fcore.git Use imap_append_astring() instead of imap_append_string() where possible. --- diff --git a/src/imap/cmd-list.c b/src/imap/cmd-list.c index fc18be2cb5..8b754a5184 100644 --- a/src/imap/cmd-list.c +++ b/src/imap/cmd-list.c @@ -249,7 +249,7 @@ static bool cmd_list_continue(struct client_command_context *cmd) list_reply_append_ns_sep_param(str, mail_namespace_get_sep(info->ns)); str_append_c(str, ' '); - imap_append_string(str, str_c(mutf7_name)); + imap_append_astring(str, str_c(mutf7_name)); mailbox_childinfo2str(ctx, str, flags); ret = client_send_line_next(ctx->cmd->client, str_c(str)); @@ -333,7 +333,7 @@ static void cmd_list_ref_root(struct client *client, const char *ref) str_printfa(str, "%c\" ", ns_sep); if (*ns_prefix != '\0') { /* non-hidden namespace, use it as the root name */ - imap_append_string(str, ns_prefix); + imap_append_astring(str, ns_prefix); } else { /* Hidden namespace or empty namespace prefix. We could just return an empty root name, but it's safer to emulate what @@ -344,7 +344,7 @@ static void cmd_list_ref_root(struct client *client, const char *ref) if (p == NULL) str_append(str, "\"\""); else - imap_append_string(str, t_strdup_until(ref, p + 1)); + imap_append_astring(str, t_strdup_until(ref, p + 1)); } client_send_line(client, str_c(str)); } diff --git a/src/imap/cmd-notify.c b/src/imap/cmd-notify.c index f1f4b2ce99..b92b95fc99 100644 --- a/src/imap/cmd-notify.c +++ b/src/imap/cmd-notify.c @@ -365,7 +365,7 @@ imap_notify_box_list_noperm(struct client *client, struct mailbox *box) str_append_c(str, ns_sep); str_append(str, "\" "); - imap_append_string(str, mailbox_get_vname(box)); + imap_append_astring(str, mailbox_get_vname(box)); client_send_line(client, str_c(str)); } diff --git a/src/imap/imap-fetch.c b/src/imap/imap-fetch.c index bb89c29fc3..ddcc3e03a0 100644 --- a/src/imap/imap-fetch.c +++ b/src/imap/imap-fetch.c @@ -833,7 +833,7 @@ static int fetch_guid(struct imap_fetch_context *ctx, struct mail *mail, return -1; str_append(ctx->state.cur_str, "X-GUID "); - imap_append_string(ctx->state.cur_str, value); + imap_append_astring(ctx->state.cur_str, value); str_append_c(ctx->state.cur_str, ' '); return 1; } @@ -860,7 +860,7 @@ static int fetch_x_mailbox(struct imap_fetch_context *ctx, struct mail *mail, i_panic("FETCH: Mailbox name not UTF-8: %s", name); str_append(ctx->state.cur_str, "X-MAILBOX "); - imap_append_string(ctx->state.cur_str, str_c(mutf7_name)); + imap_append_astring(ctx->state.cur_str, str_c(mutf7_name)); str_append_c(ctx->state.cur_str, ' '); return 1; } diff --git a/src/imap/imap-notify.c b/src/imap/imap-notify.c index 9f4ae5618c..5cd8601f91 100644 --- a/src/imap/imap-notify.c +++ b/src/imap/imap-notify.c @@ -33,10 +33,10 @@ static int imap_notify_list(struct imap_notify_namespace *notify_ns, str_append_c(str, ns_sep); str_append(str, "\" "); - imap_append_string(str, rec->vname); + imap_append_astring(str, rec->vname); if (rec->old_vname != NULL) { str_append(str, " (\"OLDNAME\" ("); - imap_append_string(str, rec->old_vname); + imap_append_astring(str, rec->old_vname); str_append(str, "))"); } return client_send_line_next(notify_ns->ctx->client, str_c(str)); diff --git a/src/imap/imap-status.c b/src/imap/imap-status.c index 1e8a173ae8..e0e7625d01 100644 --- a/src/imap/imap-status.c +++ b/src/imap/imap-status.c @@ -107,7 +107,7 @@ int imap_status_send(struct client *client, const char *mailbox_mutf7, str = t_str_new(128); str_append(str, "* STATUS "); - imap_append_string(str, mailbox_mutf7); + imap_append_astring(str, mailbox_mutf7); str_append(str, " ("); prefix_len = str_len(str); diff --git a/src/plugins/imap-acl/imap-acl-plugin.c b/src/plugins/imap-acl/imap-acl-plugin.c index 9408af9d68..990a856fc3 100644 --- a/src/plugins/imap-acl/imap-acl-plugin.c +++ b/src/plugins/imap-acl/imap-acl-plugin.c @@ -163,7 +163,7 @@ imap_acl_write_right(string_t *dest, string_t *tmp, i_unreached(); } - imap_append_string(dest, str_c(tmp)); + imap_append_astring(dest, str_c(tmp)); str_append_c(dest, ' '); imap_acl_write_rights_list(dest, rights); } @@ -288,7 +288,7 @@ static bool cmd_getacl(struct client_command_context *cmd) str = t_str_new(128); str_append(str, "* ACL "); - imap_append_string(str, mailbox); + imap_append_astring(str, mailbox); ns = mailbox_get_namespace(box); backend = acl_mailbox_list_get_backend(ns->list); @@ -347,7 +347,7 @@ static bool cmd_myrights(struct client_command_context *cmd) str = t_str_new(128); str_append(str, "* MYRIGHTS "); - imap_append_string(str, orig_mailbox); + imap_append_astring(str, orig_mailbox); str_append_c(str,' '); imap_acl_write_rights_list(str, rights); @@ -372,9 +372,9 @@ static bool cmd_listrights(struct client_command_context *cmd) str = t_str_new(128); str_append(str, "* LISTRIGHTS "); - imap_append_string(str, mailbox); + imap_append_astring(str, mailbox); str_append_c(str, ' '); - imap_append_string(str, identifier); + imap_append_astring(str, identifier); str_append_c(str, ' '); str_append(str, "\"\" l r w s t p i e k x a c d"); diff --git a/src/plugins/imap-quota/imap-quota-plugin.c b/src/plugins/imap-quota/imap-quota-plugin.c index 004691a8b1..039b84f9fa 100644 --- a/src/plugins/imap-quota/imap-quota-plugin.c +++ b/src/plugins/imap-quota/imap-quota-plugin.c @@ -43,7 +43,7 @@ quota_reply_write(string_t *str, struct mail_user *user, str_append(str, "* QUOTA "); name = imap_quota_root_get_name(user, owner, root); - imap_append_string(str, name); + imap_append_astring(str, name); str_append(str, " ("); list = quota_root_get_resources(root); @@ -102,13 +102,13 @@ static bool cmd_getquotaroot(struct client_command_context *cmd) quotaroot_reply = t_str_new(128); quota_reply = t_str_new(256); str_append(quotaroot_reply, "* QUOTAROOT "); - imap_append_string(quotaroot_reply, orig_mailbox); + imap_append_astring(quotaroot_reply, orig_mailbox); iter = quota_root_iter_init(box); while ((root = quota_root_iter_next(iter)) != NULL) { str_append_c(quotaroot_reply, ' '); name = imap_quota_root_get_name(client->user, ns->owner, root); - imap_append_string(quotaroot_reply, name); + imap_append_astring(quotaroot_reply, name); quota_reply_write(quota_reply, client->user, ns->owner, root); }