summaryrefslogtreecommitdiff
path: root/pretty.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-09-19 11:38:39 -0700
committerJunio C Hamano <gitster@pobox.com>2014-09-19 11:38:39 -0700
commit56feed1c7641bbf7920efe6607c6a04309073baa (patch)
tree74ec5c25bd752dfe55be3a4c13147af5c5dfbfc1 /pretty.c
parent9ee9c9d068d841908c7022aad566096be8a439a9 (diff)
parent415792edf51b2f87a58a942016a24a2e86a4218b (diff)
downloadgit-56feed1c7641bbf7920efe6607c6a04309073baa.tar.gz
Merge branch 'rs/export-strbuf-addchars'
Code clean-up. * rs/export-strbuf-addchars: strbuf: use strbuf_addchars() for adding a char multiple times strbuf: export strbuf_addchars()
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/pretty.c b/pretty.c
index 63e03b67e9..31f2edef11 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1377,9 +1377,7 @@ static size_t format_and_pad_commit(struct strbuf *sb, /* in UTF-8 */
* convert it back to chars
*/
padding = padding - len + local_sb.len;
- strbuf_grow(sb, padding);
- strbuf_setlen(sb, sb_len + padding);
- memset(sb->buf + sb_len, ' ', sb->len - sb_len);
+ strbuf_addchars(sb, ' ', padding);
memcpy(sb->buf + sb_len + offset, local_sb.buf,
local_sb.len);
}
@@ -1654,10 +1652,8 @@ void pp_remainder(struct pretty_print_context *pp,
first = 0;
strbuf_grow(sb, linelen + indent + 20);
- if (indent) {
- memset(sb->buf + sb->len, ' ', indent);
- strbuf_setlen(sb, sb->len + indent);
- }
+ if (indent)
+ strbuf_addchars(sb, ' ', indent);
strbuf_add(sb, line, linelen);
strbuf_addch(sb, '\n');
}