travis-ci: record and skip successfully built trees
[gitweb.git] / sideband.c
index 2782df800382eb00ab7d50f1371d71bb2849d0ba..1e4d684d6c5dcdeee94f6eb64cfa6e2f17d44674 100644 (file)
@@ -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);
@@ -108,9 +108,8 @@ int recv_sideband(const char *me, int in_stream, int out)
  * fd is connected to the remote side; send the sideband data
  * over multiplexed packet stream.
  */
-ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max)
+void send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max)
 {
-       ssize_t ssz = sz;
        const char *p = data;
 
        while (sz) {
@@ -121,16 +120,15 @@ ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet
                if (packet_max - 5 < n)
                        n = packet_max - 5;
                if (0 <= band) {
-                       sprintf(hdr, "%04x", n + 5);
+                       xsnprintf(hdr, sizeof(hdr), "%04x", n + 5);
                        hdr[4] = band;
                        write_or_die(fd, hdr, 5);
                } else {
-                       sprintf(hdr, "%04x", n + 4);
+                       xsnprintf(hdr, sizeof(hdr), "%04x", n + 4);
                        write_or_die(fd, hdr, 4);
                }
                write_or_die(fd, p, n);
                p += n;
                sz -= n;
        }
-       return ssz;
 }