]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Replace str_append_n() with str_append_max()
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sat, 21 Apr 2018 13:17:03 +0000 (16:17 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 30 Aug 2018 08:15:44 +0000 (11:15 +0300)
src/config/doveconf.c
src/doveadm/dsync/dsync-mailbox-tree-sync.c
src/lib/failures.c
src/lib/var-expand.c

index c597e85aaf5b9e9a185adcb211d96aa7eb111dda..bf1670a1031c22bd51a3b746a5afae40d7b76a0b 100644 (file)
@@ -423,7 +423,7 @@ config_dump_human_output(struct config_dump_human_context *ctx,
                                prefix.prefix_idx = prefix_idx;
                                array_append(&prefix_stack, &prefix, 1);
 
-                               str_append_n(ctx->list_prefix, indent_str, indent*2);
+                               str_append_max(ctx->list_prefix, indent_str, indent*2);
                                p = strchr(key2, '/');
                                if (p != NULL)
                                        str_append_data(ctx->list_prefix, key2, p - key2);
@@ -514,13 +514,13 @@ config_dump_filter_begin(string_t *str,
        }
 
        if (filter->local_name != NULL) {
-               str_append_n(str, indent_str, indent*2);
+               str_append_max(str, indent_str, indent*2);
                str_printfa(str, "local_name %s {\n", filter->local_name);
                indent++;
        }
 
        if (filter->remote_bits > 0) {
-               str_append_n(str, indent_str, indent*2);
+               str_append_max(str, indent_str, indent*2);
                str_printfa(str, "remote %s", net_ip2addr(&filter->remote_net));
 
                if (IPADDR_IS_V4(&filter->remote_net)) {
@@ -534,7 +534,7 @@ config_dump_filter_begin(string_t *str,
                indent++;
        }
        if (filter->service != NULL) {
-               str_append_n(str, indent_str, indent*2);
+               str_append_max(str, indent_str, indent*2);
                str_printfa(str, "protocol %s {\n", filter->service);
                indent++;
        }
index e5dd0d3aa88aa88156a2a3c98bfc5f0803424b3c..2594d1d09ee7aac9cd1d49b3cf6de10c851a88d5 100644 (file)
@@ -405,7 +405,7 @@ sync_rename_node_to_temp(struct dsync_mailbox_tree_sync_ctx *ctx,
                if (max_prefix_len > (size_t)(p - node->name))
                        max_prefix_len = p - node->name;
        }
-       str_append_n(&buf, node->name, max_prefix_len);
+       str_append_max(&buf, node->name, max_prefix_len);
        str_append_c(&buf, '-');
        prefix_len = buf.used;
 
@@ -1004,7 +1004,7 @@ sync_rename_temp_mailbox_node(struct dsync_mailbox_tree *tree,
        max_prefix_len = TEMP_MAX_NAME_LEN - strlen(new_suffix) - 1;
        if (max_prefix_len > (size_t)(p-node->name))
                max_prefix_len = p-node->name;
-       str_append_n(str, node->name, max_prefix_len);
+       str_append_max(str, node->name, max_prefix_len);
        str_append(str, new_suffix);
        while (node_has_child(node->parent, str_c(str)))
                suffix_inc(str);
index f8a8364e181dcf93b91908940f168bcd95824c3a..e8de68a8cc5efc326036e21b2591df89776c362e 100644 (file)
@@ -618,7 +618,7 @@ static int internal_send_split(string_t *full_str, size_t prefix_len)
 
        while (pos < str_len(full_str)) {
                str_truncate(str, prefix_len);
-               str_append_n(str, str_c(full_str) + pos, max_text_len);
+               str_append_max(str, str_c(full_str) + pos, max_text_len);
                str_append_c(str, '\n');
                if (log_fd_write(STDERR_FILENO,
                                 str_data(str), str_len(str)) < 0)
index 7a66db55f02e050058a6d1080238742c0a0017cb..cdb14040cd5c044c953c1b2ef61728d17ccfeeef 100644 (file)
@@ -609,7 +609,7 @@ int var_expand_with_funcs(string_t *dest, const char *str,
                                else if (!ctx.zero_padding) {
                                        if (ctx.width < 0)
                                                ctx.width = strlen(var) - (-ctx.width);
-                                       str_append_n(dest, var, ctx.width);
+                                       str_append_max(dest, var, ctx.width);
                                } else {
                                        /* %05d -like padding. no truncation. */
                                        ssize_t len = strlen(var);