Skip to content

Commit c61b2af

Browse files
npitregitster
authored andcommitted
sideband.c: small optimization of strbuf usage
Signed-off-by: Nicolas Pitre <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5e5be9e commit c61b2af

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sideband.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ int recv_sideband(const char *me, int in_stream, int out)
6868
int linelen = brk - b;
6969

7070
if (!outbuf.len)
71-
strbuf_addf(&outbuf, "%s", PREFIX);
71+
strbuf_addstr(&outbuf, PREFIX);
7272
if (linelen > 0) {
7373
strbuf_addf(&outbuf, "%.*s%s%c",
7474
linelen, b, suffix, *brk);
7575
} else {
76-
strbuf_addf(&outbuf, "%c", *brk);
76+
strbuf_addch(&outbuf, *brk);
7777
}
7878
xwrite(2, outbuf.buf, outbuf.len);
7979
strbuf_reset(&outbuf);
@@ -97,7 +97,7 @@ int recv_sideband(const char *me, int in_stream, int out)
9797
}
9898

9999
if (outbuf.len) {
100-
strbuf_addf(&outbuf, "\n");
100+
strbuf_addch(&outbuf, '\n');
101101
xwrite(2, outbuf.buf, outbuf.len);
102102
}
103103
strbuf_release(&outbuf);

0 commit comments

Comments
 (0)