summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Nicolas Pitre <nico@fluxnic.net>2016-07-05 16:35:50 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-07-06 14:09:32 -0700
commitc61b2af7bd2c7225bcf576a39c245cebf9397ead (patch)
tree33629be709cfdf1e161a9c27778ad20687c4d1b0
parentsideband.c: refactor recv_sideband() (diff)
downloadtgif-c61b2af7bd2c7225bcf576a39c245cebf9397ead.tar.xz
sideband.c: small optimization of strbuf usage
Signed-off-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--sideband.c6
1 files 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);