sideband.c: small optimization of strbuf usage

Signed-off-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nicolas Pitre committed Jul 5, 2016 at 16:35 UTC c61b2af7bd2c7225bcf576a39c245cebf9397ead
1 file changed +3 -3
sideband.c
+3 -3
@@ -68,12 +68,12 @@ int recv_sideband(const char *me, int in_stream, int out)
68 int linelen = brk - b;
69
70 if (!outbuf.len)
71 - strbuf_addf(&outbuf, "%s", PREFIX);
71 + strbuf_addstr(&outbuf, PREFIX);
72 if (linelen > 0) {
73 strbuf_addf(&outbuf, "%.*s%s%c",
74 linelen, b, suffix, *brk);
75 } else {
76 - strbuf_addf(&outbuf, "%c", *brk);
76 + strbuf_addch(&outbuf, *brk);
77 }
78 xwrite(2, outbuf.buf, outbuf.len);
79 strbuf_reset(&outbuf);
@@ -97,7 +97,7 @@ int recv_sideband(const char *me, int in_stream, int out)
97 }
98
99 if (outbuf.len) {
100 - strbuf_addf(&outbuf, "\n");
100 + strbuf_addch(&outbuf, '\n');
101 xwrite(2, outbuf.buf, outbuf.len);
102 }
103 strbuf_release(&outbuf);