sideband.c: make send_sideband() return void

The send_sideband() function uses write_or_die() for writing data which immediately terminates the process on errors. If no such error occurred, send_sideband() always returned the value that was passed as fourth parameter prior to this commit. This value is already known to the caller in any case, so let's turn send_sideband() into a void function instead. Signed-off-by: Lukas Fleischer <lfleischer@lfos.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Lukas Fleischer committed Jun 14, 2016 at 16:49 UTC 4c4b7d1d3b5be12ad83d0ecfc537b40af37462c9
3 files changed +6 -6
sideband.c
+1 -3
@@ -124,9 +124,8 @@ int recv_sideband(const char *me, int in_stream, int out)
124 * fd is connected to the remote side; send the sideband data
125 * over multiplexed packet stream.
126 */
127 -ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max)
127 +void send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max)
128 {
129 - ssize_t ssz = sz;
129 const char *p = data;
130
131 while (sz) {
@@ -148,5 +147,4 @@ ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet
147 p += n;
148 sz -= n;
149 }
151 - return ssz;
150 }
sideband.h
+1 -1
@@ -5,6 +5,6 @@
5 #define SIDEBAND_REMOTE_ERROR -1
6
7 int recv_sideband(const char *me, int in_stream, int out);
8 -ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max);
8 +void send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max);
9
10 #endif
upload-pack.c
+4 -2
@@ -60,8 +60,10 @@ static void reset_timeout(void)
60
61 static ssize_t send_client_data(int fd, const char *data, ssize_t sz)
62 {
63 - if (use_sideband)
64 - return send_sideband(1, fd, data, sz, use_sideband);
63 + if (use_sideband) {
64 + send_sideband(1, fd, data, sz, use_sideband);
65 + return sz;
66 + }
67 if (fd == 3)
68 /* emergency quit */
69 fd = 2;