Skip to content

Commit 4c4b7d1

Browse files
lfosgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 05219a1 commit 4c4b7d1

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

sideband.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,8 @@ int recv_sideband(const char *me, int in_stream, int out)
124124
* fd is connected to the remote side; send the sideband data
125125
* over multiplexed packet stream.
126126
*/
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)
128128
{
129-
ssize_t ssz = sz;
130129
const char *p = data;
131130

132131
while (sz) {
@@ -148,5 +147,4 @@ ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet
148147
p += n;
149148
sz -= n;
150149
}
151-
return ssz;
152150
}

sideband.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
#define SIDEBAND_REMOTE_ERROR -1
66

77
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);
99

1010
#endif

upload-pack.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ static void reset_timeout(void)
6060

6161
static ssize_t send_client_data(int fd, const char *data, ssize_t sz)
6262
{
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+
}
6567
if (fd == 3)
6668
/* emergency quit */
6769
fd = 2;

0 commit comments

Comments
 (0)