diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-09-19 11:38:39 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-09-19 11:38:39 -0700 |
commit | 56feed1c7641bbf7920efe6607c6a04309073baa (patch) | |
tree | 74ec5c25bd752dfe55be3a4c13147af5c5dfbfc1 /pretty.c | |
parent | 9ee9c9d068d841908c7022aad566096be8a439a9 (diff) | |
parent | 415792edf51b2f87a58a942016a24a2e86a4218b (diff) | |
download | git-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.c | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -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'); } |