Skip to content

Commit

Permalink
global: Replace str_append_n() with str_append_max()
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen committed Aug 30, 2018
1 parent 265bdb7 commit 265ee27
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/config/doveconf.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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)) {
Expand All @@ -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++;
}
Expand Down
4 changes: 2 additions & 2 deletions src/doveadm/dsync/dsync-mailbox-tree-sync.c
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/failures.c
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/var-expand.c
Expand Up @@ -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);
Expand Down

0 comments on commit 265ee27

Please sign in to comment.