summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pitre <nico@fluxnic.net>2016-07-05 20:35:50 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-07-06 21:09:32 (GMT)
commitc61b2af7bd2c7225bcf576a39c245cebf9397ead (patch)
tree33629be709cfdf1e161a9c27778ad20687c4d1b0
parent5e5be9e257239b3599701f05518ce9e45f565e9f (diff)
downloadgit-c61b2af7bd2c7225bcf576a39c245cebf9397ead.zip
git-c61b2af7bd2c7225bcf576a39c245cebf9397ead.tar.gz
git-c61b2af7bd2c7225bcf576a39c245cebf9397ead.tar.bz2
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 2782df8..c0b6dcf 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);