diff options
author | René Scharfe <l.s.r@web.de> | 2014-09-07 09:06:42 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-09-08 11:26:48 -0700 |
commit | 415792edf51b2f87a58a942016a24a2e86a4218b (patch) | |
tree | f842e55189d3d0d8991544dd4e20aa55aa3b680d /pretty.c | |
parent | d07235a027e0c7ed2fee1aeb3bee8a858bf5ca58 (diff) | |
download | git-415792edf51b2f87a58a942016a24a2e86a4218b.tar.gz |
strbuf: use strbuf_addchars() for adding a char multiple timesrs/export-strbuf-addchars
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pretty.c')
-rw-r--r-- | pretty.c | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -1400,9 +1400,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); } @@ -1679,10 +1677,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'); } |