From c61b2af7bd2c7225bcf576a39c245cebf9397ead Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Tue, 5 Jul 2016 16:35:50 -0400 Subject: sideband.c: small optimization of strbuf usage Signed-off-by: Nicolas Pitre Signed-off-by: Junio C Hamano --- sideband.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sideband.c b/sideband.c index 2782df8003..c0b6dcf703 100644 --- a/sideband.c +++ b/sideband.c @@ -68,12 +68,12 @@ int recv_sideband(const char *me, int in_stream, int out) int linelen = brk - b; if (!outbuf.len) - strbuf_addf(&outbuf, "%s", PREFIX); + strbuf_addstr(&outbuf, PREFIX); if (linelen > 0) { strbuf_addf(&outbuf, "%.*s%s%c", linelen, b, suffix, *brk); } else { - strbuf_addf(&outbuf, "%c", *brk); + strbuf_addch(&outbuf, *brk); } xwrite(2, outbuf.buf, outbuf.len); strbuf_reset(&outbuf); @@ -97,7 +97,7 @@ int recv_sideband(const char *me, int in_stream, int out) } if (outbuf.len) { - strbuf_addf(&outbuf, "\n"); + strbuf_addch(&outbuf, '\n'); xwrite(2, outbuf.buf, outbuf.len); } strbuf_release(&outbuf); -- cgit v1.2.1